一、centosos6.6下载html
windows 64位:redis
windows 32位:windows
http://pan.baidu.com/s/1o8GrpB8centos
计划安装四台centos6.6虚拟机 centos一、centos二、centos三、centos4,使用VMware® Workstation 12 Pro安装api
二、NAT联网服务器
设置固定IP,注意gatway是192.168.121.2,最后一位是2网络
四台centos机器ip分别是ssh
192.168.121.129 centos1分布式
192.168.121.130 centos2
192.168.121.131 centos3
192.168.121.132 centos4
三、更改centos机器名与hosts文件
vim /etc/sysconfig/network 更改HOSTNAME=centos1 ,同步更新另几台机器centos二、centos三、centos4
更改hosts文件
四、关闭防火墙
后期搭建zookeeper、redis等集群时,可能出现通讯问题,所以把防火墙关闭。
命令:service iptables stop;
五、免密登陆
集群机器之间通讯,须要设置免密登陆。使用命令:ssh 机器名(如ssh centos1),若是无需输入密码,直接登陆,即已设置免密登陆。
一、先免密登陆本机。
([root@centos bin]# ssh localhost,命令也会要求输入密码,配置完后就不用输入)
命令:
$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
上面命令便是在本机生成公钥/私钥对,将公钥追加到authorized_keys文件
keygen: 生成公钥/私钥对
-t dsa: 加密方式dsa,也可选择rsa
-P ‘’: 密码为空
-f ~/.ssh/id_dsa: 产生私钥文件,指定私钥后,会同步生成公钥文件id_dsa.pub
cat:将公钥文件追加到authorized_keys文件内。
二、把公钥复制到其它机器的authorized_keys中
把centos1的~/.ssh/id_dsa.pub内容追加到centos2和centos3的~/.ssh/authorized_keys中
把centos2的~/.ssh/id_dsa.pub内容追加到centos1和centos3的~/.ssh/authorized_keys中
把centos3的~/.ssh/id_dsa.pub内容追加到centos1和centos2的~/.ssh/authorized_keys中
常常经过ssh 或者 scp 链接一堆远程主机,一样是 Linux 主机,其中一些建立 ssh 链接速度特别慢,链接创建以后执行操做速度却很正常,看来应该不是网络缘由。解决的方法是经过ssh 的-v参数来查看调试信息的:
用 ssh -v 来查看详细的链接创建过程,立刻用一台创建链接很慢的主机试了一下,在一大堆输出信息中发如今这里停留最久:
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found
debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Next authentication method: publickey
原来是由于尝试了个没有意义并且会失败的 gssapi-with-mic 认证方式浪费了时间,打开(远程服务器) /etc/ssh/ssh_config 把里面的 GSSAPIAuthentication yes 改为 no 关掉它,便可让 ssh 直接尝试美妙的 publickey 认证方式。
六、jdk环境搭建
后期搭建的分布式集群,大部分是JAVA环境下运行的。如zookeeper,hadoop,所以虚拟机内都要配置jdk环境。
具体jdk环境搭建,请参考http://www.centoscn.com/image-text/install/2014/0827/3585.html