王尘宇王尘宇

研究百度干SEO做推广变成一个被互联网搞的人

Pulsar安装


##1.3 修改bookkeeper-server/conf/bk_server.conf

zkServers=node1:2181,node2:2181,node3:2181

#############################################################################

## Journal settings

#############################################################################

# Directories BookKeeper outputs its write ahead log.

# Could define multi directories to store write head logs, separated by ‘,’.

# For example:

#  journalDirectories=/tmp/bk-journal1,/tmp/bk-journal2

# If journalDirectories is set, bookies will skip journalDirectory and use

# this setting directory.

journalDirectories=/data/bk-txn

# Directory Bookkeeper outputs ledger snapshots

# could define multi directories to store snapshots, separated by ‘,’

# For example:

# ledgerDirectories=/tmp/bk1-data,/tmp/bk2-data

#

# Ideally ledger dirs and journal dir are each in a differet device,

# which reduce the contention between random i/o and sequential write.

# It is possible to run with a single disk, but performance will be significantly lower.

ledgerDirectories=/data/bk-data

##1.4 格式化[任意一台机器上执行]

./bin/bookkeeper shell metaformat

只需要执行一次。

cat /data/bk-data/current/VERSION

zk里面会生产实例信息:

##1.5 启动

./bin/bookkeeper-daemon.sh start bookie

会在data目录下生成如下信息:

连接到zk,每个节点启动后,会在zk中注册相关信息:

##1.6 查看是否启动成功

./bin/bookkeeper shell bookiesanity

#2、Pulsar集群安装

##2.1 修改配置

### Zookeeper quorum connection string

zookeeperServers=192.168.22.151:2181,192.168.22.152:2181,192.168.22.153:2181

### Configuration Store connection string

configurationStoreServers=192.168.22.151:2181,192.168.22.152:2181,192.168.22.153:2181

### Name of the cluster to which this broker belongs to

clusterName=iot-ipulsar-cluster

### Broker data port for TLS – By default TLS is disabled

brokerServicePortTls=6651

### Port to use to server HTTPS request – By default TLS is disabled

webServicePortTls=8443

### Enable the deletion of inactive topics

brokerDeleteInactiveTopicsEnabled=false

##2.2 启动Pulsar

./bin/pulsar-daemon start broker

##2.3 初始化元数据信息

./bin/pulsar initialize-cluster-metadata \

  –cluster iot-ipulsar-cluster \

  –zookeeper 192.168.22.151:2181,192.168.22.152:2181,192.168.22.153:2181 \

  –configuration-store 192.168.22.151:2181,192.168.22.152:2181,192.168.22.153:2181 \

  –web-service-url http://192.168.22.151:18080,192.168.22.152:18080,192.168.22.153:18080 \

  –web-service-url-tls https://192.168.22.151:8443,192.168.22.152:8443,192.168.22.153:8443 \

  –broker-service-url pulsar://192.168.22.151:6650,192.168.22.152:6650,192.168.22.153:6650 \

  –broker-service-url-tls pulsar+ssl://192.168.22.151:6651,192.168.22.152:6651,192.168.22.153:6651   

##2.4 修改client.conf配置文件【地址需与服务端地址一致】

# Configuration for pulsar-client and pulsar-admin CLI tools

# URL for Pulsar REST API (for admin operations)

# For TLS:

# webServiceUrl=https://localhost:8443/

webServiceUrl=http://localhost:18080/

# URL for Pulsar Binary Protocol (for produce and consume operations)

# For TLS:

# brokerServiceUrl=pulsar+ssl://localhost:6651/

brokerServiceUrl=pulsar://localhost:6650/

##2.5 验证集群服务是否正常

./bin/pulsar-admin brokers list iot-ipulsar-cluster

##2.6 测试生产消息

./bin/pulsar-client produce \

  persistent://public/default/ck.forward.log \

  -n 1 \

  -m “This is my idea!”

##2.6 测试消费消息[先启动]

./bin/pulsar-client consume \

  persistent://public/default/ck.forward.log \

  -n 100 \

  -s “forward.log.g1” \

  -t “Exclusive”

相关文章

评论列表

发表评论:
验证码

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。