https://blog.csdn.net/see_you_see_me/article/details/78468421 https://zhuanlan.zhihu.com/p/38330574 from kafka import KafkaProducer producer = KafkaProducer(bootstrap_servers=['10.17.2.11:×××'],value_serializer=lambda v: json.dumps(v).encode('utf-8'), security_protocol="SASL_PLAINTEXT", sasl_mechanism='PLAIN', sasl_plain_username='username', sasl_plain_password='passwd')
producer.send('topic', {'envtype': 'envtype', 'servicename': 'servicename', 'handleinfo': 'handleinfo'})