• centos6.6 虚拟机集群搭建


    1、centosos6.6下载

    windows 64位:

    thunder://QUFodHRwOi8vbGludXguemh1YW5neGl0b25nLmNvbTo4MDgvMjAxNTAxL0NlbnRPUy02LjYteDg2XzY0LWJpbi1EVkQxLmlzb1pa

    windows 32位:

    http://pan.baidu.com/s/1o8GrpB8

    计划安装四台centos6.6虚拟机 centos1、centos2、centos3、centos4,使用VMware® Workstation 12 Pro安装

    2、NAT联网

    设置固定IP,注意gatway是192.168.121.2,最后一位是2

    四台centos机器ip分别是

    192.168.121.129   centos1

    192.168.121.130   centos2

    192.168.121.131   centos3

    192.168.121.132   centos4

    image

    3、更改centos机器名与hosts文件

    vim /etc/sysconfig/network 更改HOSTNAME=centos1 ,同步更新另几台机器centos2、centos3、centos4

    更改hosts文件

    image

    4、关闭防火墙

    后期搭建zookeeper、redis等集群时,可能出现通信问题,因此把防火墙关闭。

    命令:service iptables stop;

    5、免密登录

    集群机器之间通信,需要设置免密登录。使用命令:ssh 机器名(如ssh centos1),如果无需输入密码,直接登录,即已设置免密登录。

    1、先免密登录本机。

    ([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文件内。

    2、把公钥复制到其它机器的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远程登录其它机器时,连接慢,有时候等半分钟才出现密码输入提示

    经常通过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 认证方式。

    6、jdk环境搭建

    后期搭建的分布式集群,大部分是JAVA环境下运行的。如zookeeper,hadoop,因此虚拟机内都要配置jdk环境。

    具体jdk环境搭建,请参考http://www.centoscn.com/image-text/install/2014/0827/3585.html

  • 相关阅读:
    【思维导图】渗透测试流程
    Imperva WAF使用笔记
    elk查询语法
    Linux入侵检测常用命令
    前端工作面试问题
    看看如何面试前端工程师:Github很重要
    编程面试的10大算法概念汇总
    菜鸟介绍达到什么样的标准才能是大公司要的前端
    开发资源总结 (持续整理中)
    超级全的前端学习资料
  • 原文地址:https://www.cnblogs.com/xckk/p/6000881.html
Copyright © 2020-2023  润新知