zookeeper(目前只有安装)

安装

流程

学kafka的时候安装

Apache ZooKeeper

安装地址:https://archive.apache.org/dist/zookeeper/zookeeper-3.5.7/apache-zookeeper-3.5.7-bin.tar.gz

解压

tar -zxvf kafka_2.12-3.0.0.tgz -C /export/server/

改配置

cd config
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg # the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/export/server/zookeeper-3.5.7/zkdata# 这里和server.几 和下面的myid匹配上
# 2888是正常leader端口,3888是备用端口
server.1=hadoop1:2888:3888
server.2=hadoop2:2888:3888
server.3=hadoop3:2888:3888:wq

在设置的dataDir目录下创建一个名字叫myid的文件(必须叫myid!!!)

写入一个数(几都行,只要三个集群别一样)

[root@hadoop1 zkdata]# echo 1 > myid

[root@hadoop2 zkdata]# echo 2 > myid

[root@hadoop3 zkdata]# echo 3 > myid

fenfa

zoo.cfg配置解毒

# 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.
# 快照所在的目录。不使用/ tmp为存储、/ tmp这里只是例子的缘故。
dataDir=/export/server/zookeeper-3.5.7/zkdata
# 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.
# 在开启自动督促之前,请务必阅读管理员指南的维护部分。
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
# dataDir中要保留的快照数量
#autopurge.snapRetainCount=3# Purge task interval in hours
# Set to "0" to disable auto purge feature
# 清除任务间隔(小时)  设置为“0”表示禁用自动清除功能
#autopurge.purgeInterval=1

原神启动

hadoop1启动

[root@hadoop1 zookeeper-3.5.7]# bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /export/server/zookeeper-3.5.7/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

[root@hadoop1 zookeeper-3.5.7]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /export/server/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Error contacting service. It is probably not running.
一看状态居然失败了?因为另外两个没启动,不过半没法选出来leader

hadoop2/3也启动

bin/zkServer.sh start

现在hadoop1状态

[root@hadoop1 zookeeper-3.5.7]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /export/server/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower


[root@hadoop2 zookeeper-3.5.7]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /export/server/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader(hadoop2成leader了)


[root@hadoop3 zookeeper-3.5.7]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /export/server/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower

批量启动脚本

#!/bin/bash
case $1 in
start)for i in hadoop1 hadoop2 hadoop3doecho ----------------  zookeeper $i start ----------------ssh $i "/export/server/zookeeper-3.5.7/bin/zkServer.sh start"done;;
stop)for i in hadoop1 hadoop2 hadoop3doecho ----------------  zookeeper $i stop ----------------ssh $i "/export/server/zookeeper-3.5.7/bin/zkServer.sh stop"done;;
status)for i in hadoop1 hadoop2 hadoop3doecho ----------------  zookeeper $i status ----------------ssh $i "/export/server/zookeeper-3.5.7/bin/zkServer.sh status"done;;
*)echo "Usage: $0 {start|stop|status}";;
esac

chmod 777 zk

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/163762.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

2021-arxiv-Prefix-Tuning- Optimizing Continuous Prompts for Generation

2021-arxiv-Prefix-Tuning- Optimizing Continuous Prompts for Generation Paper:https://arxiv.org/pdf/2101.00190.pdf Code:https://github.com/XiangLi1999/PrefixTuning 前缀调优:优化生成的连续提示 prefix-tunning 的基本思想也是想…

JUC并发编程——线程池学习:基础概念及三大方法、七大参数、四大拒绝策略(基于狂神说的学习笔记)

线程池 池化技术的本质:事先准备好一些资源,线程复用,用完即还,方便管理 默认大小:2 最大并发数max 根据电脑去设置,CPU密集型,IO密集型 线程池的好处: 降低资源的消耗提高响应的…

leetcode - 319. Bulb Switcher

Description There are n bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turning off if it’s on). For the ith round, you toggl…

中文编程开发语言工具编程实际案例:美发店会员管理系统软件编程实例

中文编程开发语言工具编程实际案例:美发店会员管理系统软件编程实例 中文编程开发语言工具编程实际案例:美发店会员管理系统软件编程实例。 软件功能: 1、系统设置:参数设定,账号及权限设置,系统初始化&a…

es6(三)——常用es6(函数、数组、对象的扩展)

ES6的系列文章目录 第一章 Python 机器学习入门之pandas的使用 文章目录 ES6的系列文章目录0、数值的扩展一、函数的扩展1、函数的默认值2、函数的reset参数 二、数组的扩展1. 将对象转成数组的Array.from()2. 将对象转成数组的Array.from()3. 实例方法 find(),fin…

Jmeter性能测试:高并发分布式性能测试

一、为什么要进行分布式性能测试 当进行高并发性能测试的时候,受限于Jmeter工具本身和电脑硬件的原因,无法满足我们对大并发性能测试的要求。 基于这种场景下,我们就需要采用分布式的方式来实现我们高并发的性能测试要求。 二、分布式性能…

Hadoop3教程(二十五):Yarn的多队列调度器使用案例

文章目录 (136)生产环境多队列创建&好处(137)容量调度器多队列提交案例如何创建多个队列如何向指定队列提交任务 (138)容量调度器任务优先级(139)公平调度器案例参考文献 &#…

高校教务系统登录页面JS分析——华东交通大学

高校教务系统密码加密逻辑及JS逆向 本文将介绍高校教务系统的密码加密逻辑以及使用JavaScript进行逆向分析的过程。通过本文,你将了解到密码加密的基本概念、常用加密算法以及如何通过逆向分析来破解密码。 本文仅供交流学习,勿用于非法用途。 一、密码加…

使用 VS Code 作为 VC6 的编辑器

使用 VS Code 作为 VC 6.0 的编辑器 由于一些众所周知的原因,我们不得不使用经典(过时)的比我们年龄还大的已有 25 年历史的 VC 6.0 来学习 C 语言。而对于现在来说,这个经典的 IDE 过于简陋,并且早已不兼容新的操作系…

跨境商城源码部署(无货源模式,多语言,多货币)

在互联网发展的背景下,跨境电商成为了全球贸易的重要形式之一。跨境商城源码部署是指将跨境电商平台的源代码部署到服务器上,以便搭建一个完整的跨境商城网站。通过部署源码,可以实现无货源模式、多语言和多货币等功能,为用户提供…

Word标题编号转换为纯文本

一、创建宏 这个要用到宏命令 打开Word文档,按下快捷键AltF8,在“宏名”栏中输入“编号转换为文本”,这是给它起的名字,然后点击“创建”在新打开的窗口上,你会看到光标在闪烁,把下面函数中的4行内容复制粘…

机器学习中参数优化调试方法

1 超参数优化 调参即超参数优化,是指从超参数空间中选择一组合适的超参数,以权衡好模型的偏差(bias)和方差(variance),从而提高模型效果及性能。常用的调参方法有: 人工手动调参 网格/随机搜索(Grid / Random Search) 贝叶斯优…

[python 刷题] 19 Remove Nth Node From End of List

[python 刷题] 19 Remove Nth Node From End of List 题目: Given the head of a linked list, remove the nth node from the end of the list and return its head. 题目说的是就是移除倒数第 n 个结点,如官方给的案例: 这里提供的 n 就是…

运筹优化 | 分支定界算法(Branch and Bound)Python求解整数规划

from gurobipy import * import copy import numpy as np import matplotlib.pyplot as plt plt.rcParams[font.sans-serif][SimHei]定义了一个线性松弛问题,并用Gurobi求解 initial_LP Model(initial LP) # 定义变量initial_LP,调用Gurobi的Model&…

SVN一直报错Error running context: 由于目标计算机积极拒绝,无法连接。解决办法【杭州多测师_王sir】...

一、发现SVN一直报错Error running context: 由于目标计算机积极拒绝,无法连接。 二、没有启动 VisualSVN Server。cmd--> services.msc打开本地服务。查看VisualSVN的三个服务的启动类型,建议选择“手动”,不能选择“禁用”,选…

电脑办公助手之桌面便签,助力高效率办公

在现代办公的快节奏中,大家有应接不暇的工作,每天面对着复杂的工作任务,总感觉时间不够用,而且工作无厘头。对于这种状态,大家可以选择在电脑上安装一款好用的办公便签软件来辅助日常办公。 敬业签是一款专为办公人士…

【Release】Photoshop ICO file format plug-in 3.0

【Introduction】 The Photoshop ICO plug-in is a file format plug-in developed for Photoshop, which allows Photoshop to directly read and write ICO format files. Because Photoshop has powerful pixel bitmap editing functions, it has many users and a good us…

“构建交互式用户界面的自定义组件应用与界面布局设置“

目录 引言自定义组件应用设置界面布局投票界面布局及实现投票选项界面总结 引言 在软件开发中,用户界面设计是至关重要的一环。良好的界面设计可以提升用户体验、增加用户黏性,并提高软件的易用性。本篇博客将介绍如何利用自定义组件应用和界面布局设置…

了解 AI :了解 AI 方面的一些术语 (中英文对照)

本心、输入输出、结果 文章目录 了解 AI :了解 AI 方面的一些术语 (中英文对照)前言AI 方面的一些术语 (中英文对照)AI 方面的一些术语 (中英文对照) - 文字版弘扬爱国精神 了解 AI &#xff1a…

PowerShell系列(十二):PowerShell Cmdlet高级参数介绍(二)

目录 1、ErrorVariable 错误变量 2、OutVariable 结果输出 3、OutBuffer 输出Buffer定义 4、PipelineVariable管道参数 今天给大家讲解PowerShell Cmdlet高级参数第二部分相关的知识,希望对大家学习PowerShell能有所帮助! 1、ErrorVariable 错误变量…