kafka改为集群版
This commit is contained in:
+5
-1
@@ -19,9 +19,13 @@ public class KafkaProducerUtils implements DisposableBean {
|
||||
|
||||
public KafkaProducerUtils() {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "192.168.0.100:30092");
|
||||
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "192.168.0.89:19092,192.168.0.90:19092,192.168.0.91:19092");
|
||||
properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
|
||||
properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
|
||||
properties.setProperty("session.timeout.ms", "15000");
|
||||
properties.setProperty("sasl.mechanism", "PLAIN");
|
||||
properties.setProperty("security.protocol", "SASL_PLAINTEXT");
|
||||
properties.setProperty("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"admin\" password=\"Goojia123456\";");
|
||||
|
||||
this.producer = new KafkaProducer<String, String>(properties);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user