CentOS下安装netcat
使用zookeeper过程中,需要监控集群状态。在使用四字命令时(echo conf | nc localhost 2181),报出如下错误:-bash: netcat: command not found。
我的系统是CentOS 6.6, 64位系统,默认没有安装netcat,下面时安装过程中遇到的一些问题。(下面都是使用root用户)
下载netcat安装包
wget http://sourceforge.NET/projects/netcat/files/netcat/0.7.1/netcat-0.7.1-1.i386.rpm
执行安装rpm -ihv netcat-0.7.1-1.i386.rpm
- rpm -ihv netcat-0.7.1-1.i386.rpm
- warning: netcat-0.7.1-1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID b2d79fc1: NOKEY
- error: Failed dependencies:
- libc.so.6 is needed by netcat-0.7.1-1.i386
- libc.so.6(GLIBC_2.0) is needed by netcat-0.7.1-1.i386
- libc.so.6(GLIBC_2.1) is needed by netcat-0.7.1-1.i386
- libc.so.6(GLIBC_2.3) is needed by netcat-0.7.1-1.i386
解决依赖包问题
yum list glibc*
- Loaded plugins: fastestmirror, security
- Loading mirror speeds from cached hostfile
- * base: mirrors.aliyun.com
- * extras: mirrors.aliyun.com
- * updates: mirrors.aliyun.com
- Installed Packages
- glibc.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6
- glibc-common.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6
- glibc-devel.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6
- glibc-headers.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6
- Available Packages
- glibc.i686 2.12-1.149.el6_6.9 updates
- glibc.x86_64 2.12-1.149.el6_6.9 updates
- glibc-common.x86_64 2.12-1.149.el6_6.9 updates
- glibc-devel.i686 2.12-1.149.el6_6.9 updates
- glibc-devel.x86_64 2.12-1.149.el6_6.9 updates
- glibc-headers.x86_64 2.12-1.149.el6_6.9 updates
- glibc-static.i686 2.12-1.149.el6_6.9 updates
- glibc-static.x86_64 2.12-1.149.el6_6.9 updates
- glibc-utils.x86_64 2.12-1.149.el6_6.9 updates
安装命令:
yum install glibc.i686
- rpm -ihv netcat-0.7.1-1.i386.rpm
- warning: netcat-0.7.1-1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID b2d79fc1: NOKEY
- Preparing... ########################################### [100%]
- 1:netcat ########################################### [100%]
安装netcat包
rpm -ihv netcat-0.7.1-1.i386.rpm
- rpm -ihv netcat-0.7.1-1.i386.rpm
- warning: netcat-0.7.1-1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID b2d79fc1: NOKEY
- Preparing... ########################################### [100%]
- 1:netcat ########################################### [100%]
再次测试zookeeper的四字命令,终于成功啦。
- echo conf | nc localhost 2181
- clientPort=2181
- dataDir=/data/zk/data1/version-2
- dataLogDir=/data/zk/log1/version-2
- tickTime=2000
- maxClientCnxns=500
- minSessionTimeout=4000
- maxSessionTimeout=40000
- serverId=1
- initLimit=10
- syncLimit=5
- electionAlg=3
- electionPort=3891
- quorumPort=2891
- peerType=0