国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
搭建 Zookeeper

先準備好三臺linux(虛擬機)。

1. 先把Java環(huán)境配好。我CentOS7 + jdk1.8.0_131

1.1 先把jdk上傳到系統(tǒng)里面(如果不會的話去百度),我在系統(tǒng)的根目錄建了一個文件夾mysoft,用來存放需要的安裝包,比如jdk、Zookeeper

1.2 然后cd 到/usr/local/下,建立一個文件夾用來存放jdk

cd /usr/local/mkdir javacd java/mkdir jdk

1.3 然后定位到我們安裝包的目錄。

 解壓安裝包到我們指定的目錄下。

cd /mysofttar -xvf jdk-8u131-linux-x64.gz -C /usr/local/java/jdk/

 

 

 ps:這里看到了Zookeeper的安裝包是因為我把Zookeeper解壓之后想起來要有Java環(huán)境的。。。。

 1.4 配置環(huán)境變量

vi /etc/profile

 

 在文件里面加入如下配置

# javaexport JAVA_HOME=/usr/local/java/jdk/jdk1.8.0_131export JRE_HOME=/usr/local/java/jdk/jdk1.8.0_131/jreexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

 

 1.5 最后刷新配置,查看Java是否安裝成功

 

2. 三臺機器,配置Zookeeper 

2.1 定位到安裝包文件夾,然后執(zhí)行解壓(所有操作三臺機器一樣)

可以看到Zookeeper已經(jīng)存在于/usr/local/目錄下了

2.2 配置一下環(huán)境變量(此步驟的目的是:每次啟動服務(wù)就不需要定位到Zookeeper的bin目錄了)

vi /etc/profile

加上

# Zookeeperexport ZOOKEEPER_HOME
=/usr/local/zookeeper-3.4.10export PATH=$ZOOKEEPER_HOME/bin:$PATH

 

這里要說明一下,因為我是一邊部署一邊截圖的,而這個步驟到后面貌似有點問題,所以你們就直接把Zookeeper的配置移動到Java上面去!!!

 

2.3 配置Zookeeper的配置文件

看一下Zookeeper的目錄結(jié)構(gòu)先

bin目錄主要都是啟動相關(guān)的,conf則是與配置相關(guān)的。進入conf文件夾,修改一下配置文件名字(純粹為了方便)

cd /usr/local/cookeeper-3.4.10/confmv zoo_simple.cfg zoo.cfgvi zoo.cfg

 

 

 2.4 具體配置

首先 修改 dataDir,顧名思義就是【數(shù)據(jù)目錄】了,修改成我們自定義的即可。

然后看下面的三個server:

(1)為什么是三個,因為Zookeeper喜歡奇數(shù)不喜歡偶數(shù)。

(2)三行server解釋

官方解釋

The entries of the form server.X list the servers that make up the ZooKeeper service. When the server starts up, it knows which server it is by looking for the file myid in the data directory. That file has the contains the server number, in ASCII.

Finally, note the two port numbers after each server name: " 2888" and "3888". Peers use the former port to connect to other peers. Such a connection is necessary so that peers can communicate, for example, to agree upon the order of updates. More specifically, a ZooKeeper server uses this port to connect followers to the leader. When a new leader arises, a follower opens a TCP connection to the leader using this port. Because the default leader election also uses TCP, we currently require another port for leader election. This is the second port in the server entry.

蹩腳翻譯

表單server.X的條目列出構(gòu)成ZooKeeper服務(wù)的服務(wù)器。當(dāng)服務(wù)器啟動時,它通過查找數(shù)據(jù)目錄中的文件myid來知道它是哪個服務(wù)器 。該文件包含服務(wù)器編號,以ASCII格式顯示。

最后,請注意每個服務(wù)器名稱后面的兩個端口號:“2888”和“3888”。對等體使用前端口連接到其他對等體。這樣的連接是必要的,使得對等體可以進行通信,例如,以商定更新的順序。更具體地說,一個ZooKeeper服務(wù)器使用這個端口來連接追隨者到領(lǐng)導(dǎo)者。當(dāng)新的領(lǐng)導(dǎo)者出現(xiàn)時,追隨者使用此端口打開與領(lǐng)導(dǎo)者的TCP連接。因為默認領(lǐng)導(dǎo)選舉也使用TCP,所以我們目前需要另外一個端口進行領(lǐng)導(dǎo)選舉。這是服務(wù)器條目中的第二個端口。

大概意思

server.X=A:B:C

X-代表服務(wù)器編號

A-代表ip

B和C-代表端口,這個端口用來系統(tǒng)之間通信

2.5 查看配置文件,根據(jù)dataDir進行X的配置【這里三臺服務(wù)器不一樣?。?!】

找到你配的那一行,Esc,然后:q!退出,找到Zookeeper目錄,新建data文件夾,并且在data文件夾下面創(chuàng)建一個文件,叫myid,并且在文件里寫入server.X對應(yīng)的X

然后

cd datavi myid#之后會產(chǎn)生一個新文件,直接在里面寫X即可#比如我配置的三個server,當(dāng)前服務(wù)器的ip是多少,myid里面寫的X就是server.X=ip:2888:3888 中ip所對應(yīng)的X

server.0=192.168.127.129:2888:3888【192.168.127.129服務(wù)器上面的myid填寫0】
 server.1=192.168.127.130:2888:3888【192.168.127.130服務(wù)器上面的myid填寫1】
 server.2=192.168.127.131:2888:3888【192.168.127.131服務(wù)器上面的myid填寫2】

 

2.6 最后啟動服務(wù)器

先刷新一下環(huán)境變量

source /etc/profile

 

然后

zkServer.sh start

 

輸出信息:
ZooKeeper JMX enabled by defaultUsing config:
/usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... STARTED

 

看起來啟動起來了,是否真正啟動,執(zhí)行以下命令

zkServer.sh status

 

一般來說,都會報錯哈哈哈?。?!

[root@localhost conf]# zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgError contacting service. It is probably not running.

 

為什么呢,我想到會不會是防火墻的問題,我先看端口有沒有監(jiān)聽,3888已經(jīng)監(jiān)聽了,所以應(yīng)該是防火墻的問題

[root@localhost conf]# netstat -tunlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      2729/dnsmasq        tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1464/sshd           tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1467/cupsd          tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2611/master         tcp6       0      0 :::38952                :::*                    LISTEN      12714/java          tcp6       0      0 192.168.127.129:3888    :::*                    LISTEN      12714/java          tcp6       0      0 :::22                   :::*                    LISTEN      1464/sshd           tcp6       0      0 ::1:631                 :::*                    LISTEN      1467/cupsd          tcp6       0      0 ::1:25                  :::*                    LISTEN      2611/master         tcp6       0      0 :::2181                 :::*                    LISTEN      12714/java          

 

關(guān)閉防火墻

systemctl stop firewalld

之后果然好了起來,以下是三臺服務(wù)器的啟動結(jié)果。

192.168.127.129

[root@localhost conf]# zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@localhost conf]# netstat -tunlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      2729/dnsmasq        tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1464/sshd           tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1467/cupsd          tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2611/master         tcp6       0      0 :::38952                :::*                    LISTEN      12714/java          tcp6       0      0 192.168.127.129:3888    :::*                    LISTEN      12714/java          tcp6       0      0 :::22                   :::*                    LISTEN      1464/sshd           tcp6       0      0 ::1:631                 :::*                    LISTEN      1467/cupsd          tcp6       0      0 ::1:25                  :::*                    LISTEN      2611/master         tcp6       0      0 :::2181                 :::*                    LISTEN      12714/java          udp        0      0 0.0.0.0:5353            0.0.0.0:*                           768/avahi-daemon: r udp        0      0 127.0.0.1:323           0.0.0.0:*                           793/chronyd         udp        0      0 0.0.0.0:33617           0.0.0.0:*                           1247/dhclient       udp        0      0 0.0.0.0:50192           0.0.0.0:*                           768/avahi-daemon: r udp        0      0 192.168.122.1:53        0.0.0.0:*                           2729/dnsmasq        udp        0      0 0.0.0.0:67              0.0.0.0:*                           2729/dnsmasq        udp        0      0 0.0.0.0:68              0.0.0.0:*                           1247/dhclient       udp6       0      0 ::1:323                 :::*                                793/chronyd         udp6       0      0 :::63891                :::*                                1247/dhclient       [root@localhost conf]# zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgError contacting service. It is probably not running.[root@localhost conf]# systemctl stop firewalld[root@localhost conf]# zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... already running as process 12714.[root@localhost conf]# zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgMode: follower[root@localhost conf]# 

 

192.168.127.130

[root@localhost data]# zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@localhost data]# netstat -tunlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      2715/dnsmasq        tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1463/sshd           tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1462/cupsd          tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2393/master         tcp6       0      0 :::52456                :::*                    LISTEN      9270/java           tcp6       0      0 192.168.127.130:3888    :::*                    LISTEN      9270/java           tcp6       0      0 :::22                   :::*                    LISTEN      1463/sshd           tcp6       0      0 ::1:631                 :::*                    LISTEN      1462/cupsd          tcp6       0      0 ::1:25                  :::*                    LISTEN      2393/master         tcp6       0      0 :::2181                 :::*                    LISTEN      9270/java           udp        0      0 0.0.0.0:5353            0.0.0.0:*                           772/avahi-daemon: r udp        0      0 127.0.0.1:323           0.0.0.0:*                           821/chronyd         udp        0      0 0.0.0.0:60370           0.0.0.0:*                           772/avahi-daemon: r udp        0      0 192.168.122.1:53        0.0.0.0:*                           2715/dnsmasq        udp        0      0 0.0.0.0:67              0.0.0.0:*                           2715/dnsmasq        udp        0      0 0.0.0.0:68              0.0.0.0:*                           1247/dhclient       udp        0      0 0.0.0.0:5765            0.0.0.0:*                           1247/dhclient       udp6       0      0 :::47268                :::*                                1247/dhclient       udp6       0      0 ::1:323                 :::*                                821/chronyd         [root@localhost data]# systemctl stop firewalld[root@localhost data]# zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... already running as process 9270.[root@localhost data]# zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgMode: follower[root@localhost data]# 

 

192.168.127.131

[root@localhost data]# zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@localhost data]# netstat -tunlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      2738/dnsmasq        tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1464/sshd           tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1468/cupsd          tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2614/master         tcp6       0      0 :::34092                :::*                    LISTEN      9224/java           tcp6       0      0 192.168.127.131:3888    :::*                    LISTEN      9224/java           tcp6       0      0 :::22                   :::*                    LISTEN      1464/sshd           tcp6       0      0 ::1:631                 :::*                    LISTEN      1468/cupsd          tcp6       0      0 ::1:25                  :::*                    LISTEN      2614/master         tcp6       0      0 :::2181                 :::*                    LISTEN      9224/java           udp        0      0 0.0.0.0:39568           0.0.0.0:*                           1249/dhclient       udp        0      0 0.0.0.0:5353            0.0.0.0:*                           819/avahi-daemon: r udp        0      0 0.0.0.0:53561           0.0.0.0:*                           819/avahi-daemon: r udp        0      0 127.0.0.1:323           0.0.0.0:*                           825/chronyd         udp        0      0 192.168.122.1:53        0.0.0.0:*                           2738/dnsmasq        udp        0      0 0.0.0.0:67              0.0.0.0:*                           2738/dnsmasq        udp        0      0 0.0.0.0:68              0.0.0.0:*                           1249/dhclient       udp6       0      0 ::1:323                 :::*                                825/chronyd         udp6       0      0 :::7584                 :::*                                1249/dhclient       [root@localhost data]# systemctl stop firewalld[root@localhost data]# zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgStarting zookeeper ... already running as process 9224.[root@localhost data]# zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfgMode: leader[root@localhost data]# 

 

其實也可以查看啟動過程

zkServer.sh start-foreground

 

關(guān)于防火墻關(guān)閉的問題,應(yīng)該是不安全的,你可以吧2888,3888端口添加進開放端口中,我還沒來得及試試

firewall-cmd --zone=public --add-port=2888/tcp --permanent
firewall-cmd --zone=public --add-port=3888/tcp --permanent

 

 

到此看到三臺的狀態(tài)了,相關(guān)教程會陸續(xù)更新。。。可能會有點慢哦

 

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Wireshark抓包,帶你快速入門
ZooKeeper學(xué)習(xí)第三期---Zookeeper命令操作
Android實現(xiàn)TCP與UDP傳輸
怎么測試Windows系統(tǒng)中的服務(wù)器端口是否開放?
WindowsServer2008 R2 文件共享設(shè)置
更改 vsftpd 的端口號
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服