Zookeeper 学习的一些资料和实操遇到的问题的记录

主要参考地址:https://www.cnblogs.com/leeSmall/p/9563547.html

zookeeper安装问题:https://blog.csdn.net/peng2hui1314/article/details/107255142/

  注意配置文件多余空格问题,会导致启动失败,认真检查  

  注意不要下载错了版本
          标准版本(apache-zookeeper-3.8.4-bin.tar.gz)
          源码版本 (apache-zookeeper-3.8.4.tar.gz)
     端口冲突问题
          在3.5.5版本及以上,Zookeeper 提供了一个内嵌的Jetty容器来运行 AdminServer,默认占用的是 8080端口,
          AdminServer 主要是来查看 Zookeeper 的一些状态,如果机器上有其他程序(比如:Tomcat)占用了 8080 端口,也会导致 Starting zookeeper … FAILED TO START 的问题。
        可以通过以下几种方式去解决:
            # 禁用 AdminServer 服务
            admin.enableServer=false
            # admin port 绑定其他端口
            admin.serverPort=9000

 windterm链接本地vm
查询ip地址
    ip addr show
安装OpenSSH服务软件包
    sudo apt update
        更新失败肯那个因为链接镜像源失败,需要修改
        sudo vim /etc/apt/sources.list
            将‘cn.archive.ubuntu.com’替换为‘mirrors.aliyun.com’即可
    sudo apt install openssh-server
查看OpenSSH服务状态
    sudo systemctl status ssh
安装java
    查看java:
        java -version
    安装:
        sudo apt install openjdk-17-jre-headless
zookeeper安装
下载zookeeper
    sudo wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
解压:
    tar -zxvf zookeeper-3.4.6.tar.gz

    之后的本地zookeeper本地集群配置参考:https://www.cnblogs.com/ruber/p/18519857
启动zookeeper:
    sudo bin/zkServer.sh start conf/zoo1.cfg
关闭zookeeper:
    sudo bin/zkServer.sh stop conf/zoo1.cfg
查看zookeeper状态:
    sudo bin/zkServer.sh status conf/zoo1.cfg


windTerm 链接本地 VMware连不上问题: VMware Network Adapter VMnet8被禁用了

  

 配置文件内容

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/software/zk1
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpHost=0.0.0.0
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

#master对应于前面在hosts里面配置的主机映射 2888是数据同步和消息传递端口,3888是选举端口
server.1=localhost:2888:3888

#master对应于前面在hosts里面配置的主机映射 2889是数据同步和消息传递端口,3889是选举端口 
server.2=localhost:2889:3889

#master对应于前面在hosts里面配置的主机映射 2890是数据同步和消息传递端口,3890是选举端口 
server.3=localhost:2890:3890

#如果不需要AdminServer,可以直接禁用
admin.enableServer=false
#如果想使用AdminServer,可以配置端口号,默认的8080可能被占用,导致起不来
#admin.serverPort=8080

#禁用sasl登录验证
zookeeper.sasl.client=false

 zookeeper官网地址: https://zookeeper.apache.org/doc/current/zookeeperAdmin.html

posted @ 2024-11-01 11:44  花开如梦  阅读(1)  评论(0编辑  收藏  举报