kafka模拟数据下发

kafka模拟数据下发

Posted by wenfengSAT on March 4, 2019

kafka模拟数据下发

  • 1、监听
	
/home/kafka/9092/kafka-0.10.2.1/bin/kafka-console-consumer.sh  --from-beginning --topic t-directive-aep2dmp-tbox --zookeeper 10.219.14.25:2181,10.219.14.27:2181,10.219.14.28:2181

/home/kafka/9092/kafka-0.10.2.1/bin/kafka-console-consumer.sh  --from-beginning --topic t-directive-down-dmp-connector-01 --zookeeper 10.219.14.25:2181,10.219.14.27:2181,10.219.14.28:2181

/home/kafka/9092/kafka-0.10.2.1/bin/kafka-console-consumer.sh  --from-beginning --topic t-session-1 --zookeeper 10.219.14.25:2181,10.219.14.27:2181,10.219.14.28:2181


  • 2、模拟下发
    
执行:/home/kafka/9092/kafka-0.10.2.1/bin/kafka-console-producer.sh --broker-list 10.219.14.22:9092 --topic t-directive-aep2dmp-tbox

输入:
{
	"DeviceType": "1",
	"DeviceID": "CG001821000119",
	"OrderId": "766603",
	"DirectiveId": "223",
	"DirectiveParam": {
		"Longitude": "686140716000",
		"Latitude": "138208932000",
		"gpsType": "1"
	}
}

  • 3、查看日志
	实时查看全部日志:
	
	tail -f XXX.log
	
	实时查看过滤日志:
	
	tail -f dmp.2019-03-04.log | grep "CG001821000137"

	查找历史日志:
	
	grep "CG001837000056" dmp.2019-03-01.log | more