单节点,非集群
docker pull zookeeper:3.9
目录树
zookeeper
├─ config
│ └─ zoo.cfg
├─ data
├─ docker-compose.yml
└─ logs
单节点配置
docker-compose.yml
version: '3'
services:
zookeeper:
image: zookeeper
restart: always
container_name: zookeeper
volumes:
- ./config:/conf
- ./data:/data
- ./logs:/datalog
ports:
- "2181:2181"
zoo.cfg配置
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
autopurge.snapRetainCount=3
autopurge.purgeInterval=0
maxClientCnxns=1000
standaloneEnabled=true
admin.enableServer=true
server.1=10.114.32.44:2888:3888;2181
SSL 配置
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
autopurge.snapRetainCount=3
autopurge.purgeInterval=0
maxClientCnxns=1000
standaloneEnabled=true
admin.enableServer=true
server.1=[IP]:2888:3888
serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory
secureClientPort=2181
ssl.keyStore.location=/var/certs/van_demo/127_0_0_1_keystore.pem
ssl.trustStore.location=/var/certs/certs/cacert.pem
启动服务
docker-compose up -d