3 linux set up Pulsar cluster environment for testing
Pulsar cluster requires 3 components: ZooKeeper cluster, BookKeeper cluster and Broker cluster The following deployment strategies: 192.168.1.46 (deploy BookKeeper, deploy broker) 192.168.1.47 (deploy Bookkeeper, deploy broker) 192.168.1.48 (deploy single ZK, deploy BookKeeper, deploy broker) preliminary preparation 1)jdk1.8 2)Create a data directory at the root of each machine, download apache-pulsar-2.4.2-bin.tar.gz and copy to the data directory chmod 777 apache-pulsar-2.4.2-bin.tar.gz tar xvfz apache-pulsar-2.4.2-bin.tar.gz ZooKeeper Cluster For simple deployment on one machine a single ZK is used. 1)Create zookeeper and zookeeper/logs directories under the data directory 2)Modify zookeeper.conf file dataDir=/data/zookeeper dataLogDir=/data/zookeeper/logs server.3=192.168.1.48:2888:3888 3)echo 3 > /data/zookeeper/zookeeper/myid 4)Start zk /data/apache-pulsar-2.4.2$ PULSAR_EXTRA_OPTS="-Dstats_server_port=8001" bin/pulsar-daemon start zookeeper (Note: PULSAR_EXTRA_OPTS="-Dstats_server_port=8001" should be added when ZK and broker deployment are started on the same machine, otherwise there will be conflicts later) 5)Initialize cluster metadata bin/pulsar initialize-cluster-metadata \ --cluster pulsar-cluster-zk \ --zookeeper 192.168.1.48:2181 \ --configuration-store 192.168.1.48:2181 \ --web-service-url http://192.168.1.48:8080 \ --web-service-url-tls https://192.168.1.48:8443 \ --broker-service-url pulsar://192.168.1.48:6650 \ --broker-service-url-tls pulsar+ssl://192.168.1.48:6651 Two Bookkeeper clusters 1)Create/data/bookkeeper/directory 2)bookkeeper.conf file advertisedAddress=HOSTNAMEIP (fill in according to machine IP) zkServers=192.168.1.48:2181 journalDirectory=/data/bookkeeper/journal ledgerDirectories=/data/bookkeeper/ledgers 3 Execute the initialize metadata command; if prompted, enter Y and continue (only once on a cookie node) /data/apache-pulsar-2.4.2$ bin/bookkeeper shell metaformat 4)Start data/apache-pulsar-2.4.2$ bin/pulsar-daemon start cookie 5)The other two machines are started according to the above operations Three deployment broker clusters 1 Modify the configuration file broker.conf zookeeperServers=192.168.1.48:2181 configurationStoreServers=192.168.1.48:2181 advertisedAddress=HOSTNAME (fill in according to machine IP) clusterName=pulsar-cluster-zk 2 Start data/apache-pulsar-2.4.2$ bin/pulsar-daemon start broker 3 The other two machines are started according to the above operations