连接服务器失败,要么是本地参数没设对, 要么服务器没开!
使用Kafka发送消息好搞,按照 /opt/nvidia/deepstream/deepstream-6.2/sources/libs/kafka_protocol_adaptor/README 一步一步来就行了,前提是要搞kafka 环境搭建开启, 这个在README 里面是没有提到的。
kafka 环境搭建:
参考https://kafka.apache.org/quickstart
安装kafka和创建topics/events
https://www.apache.org/dyn/closer.cgi?path=/kafka/3.4.0/kafka_2.13-3.4.0.tgz
$ tar -xzf kafka_2.13-3.4.0.tgz
$ cd kafka_2.13-3.4.0
2.1 Start the ZooKeeper service
$ ./bin/zookeeper-server-start.sh config/zookeeper.properties
2.2 start a new teminal, Start the Kafka broker service
$ ./bin/kafka-server-start.sh config/server.properties
3.1 创建主题。
$ ./bin/kafka-topics.sh --create --topic mytopic --bootstrap-server localhost:9092
3.2 开启生产者,写events
$ ./bin/kafka-console-producer.sh --topic mytopic --bootstrap-server localhost:9092
下面写测试消息
My test
3.2 开启消费者
$ ./bin/kafka-console-consumer.sh --topic mytopic --from-beginning --bootstrap-server localhost:9092
显示
My test
$ cd /opt/nvidia/deepstream/deepstream-6.2/sources/apps/sample_apps/deepstream-test4
配置好
dstest4_config.yml
msgbroker:
proto-lib: /opt/nvidia/deepstream/deepstream-6.2/lib/libnvds_kafka_proto.so
conn-str: localhost;9092
topic: mytopic
$ ./deepstream-test4-app dstest4_config.yml
即可
按照 /opt/nvidia/deepstream/deepstream-6.2/sources/libs/amqp_protocol_adaptor/README
$sudo service rabbitmq-server status
Running 即可
make 后测试
./test_amqp_proto_async
./test_amqp_proto_sync
都没有问题,下面创建exchange, Queue, Bind Queue to exchange
使用
$ ./deepstream-test4-app -i …/…/…/…/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-6.2/lib/libnvds_amqp_proto.so --conn-str=“localhost;5672;guest;guest” --topic=topicname -s 0
没有问题,但是
如果按照官方文档kafaka模板更改
dstest4_config.yml
msgbroker:
proto-lib: /opt/nvidia/deepstream/deepstream-6.2/lib/libnvds_amqp_proto.so
conn-str: localhost;5672
topic: topicname
sync: 0
$ ./deepstream-test4-app dstest4_config.yml
问题来了,报错:
ERROR from element nvmsg-broker: Could not configure supporting library.
Error details: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvmsgbroker/gstnvmsgbroker.cpp(401): legacy_gst_nvmsgbroker_start (): /GstPipeline:dstest4-pipeline/GstNvMsgBroker:nvmsg-broker:
unable to connect to broker library
再次更改dstest4_config.yml,添加用户名密码
msgbroker:
proto-lib: /opt/nvidia/deepstream/deepstream-6.2/lib/libnvds_amqp_proto.so
#conn-str: localhost;5672
conn-str: localhost;5672;guest;guest
topic: topicname
sync: 0
$ ./deepstream-test4-app dstest4_config.yml
跑起来了!
浏览器输入:http://localhost:15672