一、环境描述:
在CentOS6.x系统环境下,使用yum命令的形式安装zookeeper-server,由于我这里是重新安装zookeeper-server,所以在正式开始之前我需要将原本的zookeeper服务进行卸载。这里使用的是yum在线方式,所以我就不搭建本地的yum源库,也正因为如此要求实验的CentOS6.x系统能够连接到外网。
二、卸载zookeeper-server
1、首先使用yum list installed命令查看本地安装的服务列表,并找到需要卸载的部件名称,如下图:
root@localhost:/home/yang]#yum list installed
2、使用yum remove 命令对zookeeper.x86_64进行卸载。注意,在使用yum remove命令时,命令后面所带的字段名称即为需要卸载的东西。
root@localhost:/home/yang]#yum remove zookeeper.x86_64
当提示内容如下时,可直接yes即可。当出现Complete!时表示已经卸载成功了,不过还是建议使用yum list installed命令进行查看。
三、使用yum安装zookeeper-server
使用yum安装zookeeper-server的命令真的很简单。
root@localhost:/home/yang]#yum install zookeeper-server
于是乎,直接运行了这个命令,结果却让我大吃一惊。下面的错误对于你来说是不是很熟悉呢?
Loaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile* base: ftp.* extras: ftp.ksu.edu.tw* updates: ftp.ksu.edu.twhttp://ftp./centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.'"Trying other mirror.http://ftp.stu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.stu.edu.tw'"Trying other mirror.http://ftp.yzu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.yzu.edu.tw'"Trying other mirror./centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror./repository/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors./centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror./centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors.tuna./centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.tuna.'"Trying other mirror./cdh5/redhat/5/x86_64/cdh/5/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://ftp.ksu.edu.tw/pub/CentOS/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.ksu.edu.tw'"Trying other mirror.http://ftp./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.'"Trying other mirror.http://mirror./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirror.'"Trying other mirror./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror./repository/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors.tuna./centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.tuna.'"Trying other mirror.http://ftp.ksu.edu.tw/pub/CentOS/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.ksu.edu.tw'"Trying other mirror.http://ftp./centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.'"Trying other mirror.http://ftp.stu.edu.tw/Linux/CentOS/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.stu.edu.tw'"Trying other mirror./centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror./repository/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors./centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror./centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors.tuna./centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.tuna.'"Trying other mirror.Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package zookeeper-server.x86_64 0:3.4.5+cdh5.15.0+144-1.cdh5.15.0.p0.52.el5 will be installedhttp://ftp./centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.'"Trying other mirror.http://ftp.stu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.stu.edu.tw'"Trying other mirror.http://ftp.yzu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.yzu.edu.tw'"Trying other mirror./centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror./repository/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors./centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror.http://mirrors./centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.'"Trying other mirror./centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host ''"Trying other mirror.http://mirrors.tuna./centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.tuna.'"Trying other mirror.Error: failure: repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2 from base: [Errno 256] No more mirrors to try.You could try using --skip-broken to work around the problemYou could try running: rpm -Va --nofiles –nodigest
这里就不兜圈子了,直接上解决的方法!我这里为了尽可能少的打shell字符,我直接进入/etc/yum.repos.d目录中。可以看到,我这里/etc/yum.repos.d目录下面,有几个文件。CentOS-Base.repo是我们要更新的,至于其它的先不用管。
root@localhost:/home/yang]#cd /etc/yum.repos.d
不过要说明的是,我这里由于是重新安装,所以我打算连cloudera-cdh5.repo文件也更新一下,也就是先删除再重新下载。如果是初次安装zookeeper-server的话,cloudera-cdh5.repo文件应该是没有的。
root@localhost:/etc/yum.repos.d]#rm -rf cloudera-cdh5.reporoot@localhost:/etc/yum.repos.d]#wget /cdh5/redhat/6/x86_64/cdh/cloudera-cdh5.repo
为了在使用yum命令时网速能更快些,我们需要将在线的yum源指定到国内的服务器上。在进行CentOS-Base.repo文件更新时,需要将CentOS-Base.repo文件,备份成以.backup为后缀的备份文件,以免我们更新的新文件用不了。
root@localhost:/etc/yum.repos.d]#mv CentOS-Base.repo CentOS-Base.repo.backuproot@localhost:/etc/yum.repos.d]#wget /.help/CentOS6-Base-163.reporoot@localhost:/etc/yum.repos.d]#mv CentOS6-Base-163.repo CentOS-Base.repo
到此为止,我想再次尝试使用yum命令,对zookeeper-server进行安装。可不幸运的是,还是报出了如下的错误,但相对于前者而言,似乎错误明显改观了许多。
Loaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile/cdh5/redhat/6/x86_64/cdh/5/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalidTrying other mirror.Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package zookeeper-server.x86_64 0:3.4.5+cdh5.15.0+144-1.cdh5.15.0.p0.52.el5 will be installedbase/filelists_db| 6.4 MB00:04/cdh5/redhat/6/x86_64/cdh/5/repodata/filelists.xml.gz: [Errno 14] Peer cert cannot be verified or peer cert invalidTrying other mirror.Error: failure: repodata/filelists.xml.gz from cloudera-cdh5: [Errno 256] No more mirrors to try.You could try using --skip-broken to work around the problemYou could try running: rpm -Va --nofiles –nodigest
由于它是Peer cert cannot be verified or peer cert invalid类型的错误,所以我们要修改一下/etc/yum.conf文件的配置内容。可直接编辑该文件
root@localhost:/etc/yum.repos.d]#vi /etc/yum.conf
在文件中,添加如下内容:
sslverify=false
最后,需要将一些部件进行更新一下:
root@localhost:/etc/yum.repos.d]#yum check-update
最后的最后,我们可以正式对zookeeper-server进行下载安装了:
root@localhost:/etc/yum.repos.d]#yum install zookeeper-server
当提示Is this ok [y/N]: 时,直接输入y即可。
此时,如果你的网速不是很好的话,建议你先去小卖部逛两圈,顺便路过奶茶店记得帮小编带一杯不加糖的绿茶,虽然我也喝不到,不过随便了。
好了,经过漫长的等待之后,当提示以下内容时,恭喜你已经通过yum命令完成了zookeeper-server的安装。
最后,小编还想再啰嗦一点的就是,通过这种方式部署集群的话,效率显然并不是很高!现在,你或许以为自己已经真正的部署了zookeeper-server而沾沾自喜,其实并不然。我们只是将zookeeper-server安装到了我们的机器上,还没有对其进行初始化和集群分配,也就是说并没有对它进行部署和使用。
值得啰嗦的是,zookeeper集群的搭建必须是奇数个机器哦,还有的就是最低要求也要3台服务器~
如果觉得《CentOS6.x环境通过yum命令安装或重装zookeeper-server》对你有帮助,请点赞、收藏,并留下你的观点哦!