Chinaunix首页 | 论坛 | 博客
  • 博客访问: 96910
  • 博文数量: 34
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 350
  • 用 户 组: 普通用户
  • 注册时间: 2014-07-04 22:47
文章分类

全部博文(34)

文章存档

2017年(34)

我的朋友

分类: 服务器与存储

2017-04-14 07:36:18

Director:
192.168.0.118 director.shamereedwine.com dr

webserver:
node1:node1.shamereedwine.com(192.168.0.119)
node2:node2.shamereedwine.com(192.168.0.120)

dbserver:
node2.shamereedwine.com(192.168.0.120)
node3.shamereedwine.com(192.168.0.122)


一、安装ansible
DR上
1、配置epel的yum源,使用yum安装ansible
yum install ansible

二、各节点配置互信

1、各节点上编辑/etc/hosts配置文件,以实现各主机的互相解析,配置如下:

192.168.0.118 director.shamereedwine.com dr
192.168.0.119 node1.shamereedwine.com node1
192.168.0.120 node2.shamereedwine.com node2
192.168.0.122 node3.shamereedwine.com node3

2、dr节点配置ssh互信

[root@localhost ~]# ssh-keygen -t rsa -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
a5:ce:85:ba:74:67:51:3c:ae:4b:0d:7e:d6:4d:ef:e1 root@director.shamereedwine.com
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|           .     |
|          . +    |
|         + o .   |
|        S + .   .|
|       + o = . o.|
|      o + * + ..o|
|     . o + +  ...|
|      .   .    E.|
+-----------------+

[root@localhost ~]# ssh-copy-id -i .ssh/id_rsa.pub root@node1.shamereedwine.com

[root@localhost ~]# ssh-copy-id -i .ssh/id_rsa.pub root@node2.shamereedwine.com
The authenticity of host 'node2.shamereedwine.com (192.168.0.120)' can't be established.
RSA key fingerprint is cf:98:8a:b1:33:6d:1b:6c:85:34:54:0b:33:f5:27:99.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2.shamereedwine.com,192.168.0.120' (RSA) to the list of known hosts.
root@node2.shamereedwine.com's password:
Now try logging into the machine, with "ssh 'root@node2.shamereedwine.com'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[root@localhost ~]# ssh-copy-id -i .ssh/id_rsa.pub root@node3.shamereedwine.com
The authenticity of host 'node3.shamereedwine.com (192.168.0.122)' can't be established.
RSA key fingerprint is cf:98:8a:b1:33:6d:1b:6c:85:34:54:0b:33:f5:27:99.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node3.shamereedwine.com,192.168.0.122' (RSA) to the list of known hosts.
root@node3.shamereedwine.com's password:
Now try logging into the machine, with "ssh 'root@node3.shamereedwine.com'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

三、使用ansible

1、探测各节点是否在线







阅读(1402) | 评论(0) | 转发(0) |
0

上一篇:nginx

下一篇:kvm安装及使用

给主人留下些什么吧!~~