已存在salt中的机器,为了规范,需要将这批主机改名

操作流程:在master把这批机器剔除;然修改这批机器的主机名、在/etc/salt目录下、用mv把minion_id和pki的目录重命名、重启salt-minion服务(在mster段能再次监控到这台主机后、可把上面重命名的文件删除)

环境:http://www.cnblogs.com/zzzhfo/p/6126223.html

把salt-client-01改名为salt-minion-01

  • 在salt-server上把salt-client-01剔除
[root@salt-server /]# salt-key -L
Accepted Keys:
salt-client-
salt-client-
Denied Keys:
Unaccepted Keys:
Rejected Keys: [root@salt-server /]# salt-key -d 'salt-client-01' -y
Deleting the following keys:
Accepted Keys:
salt-client-
Key for minion salt-client- deleted.
[root@salt-server /]# salt-key -L
Accepted Keys:
salt-client-
Denied Keys:
Unaccepted Keys:
salt-client-01
Rejected Keys:

修改主机名

[root@salt-client- /]# cat /etc/sysconfig/network  #重启生效
NETWORKING=yes
HOSTNAME=salt-minion-
[root@salt-client- /]# hostname salt-minion-
[root@salt-client- /]# bash

删除minion_id和pki(建议使用mv命令)

[root@salt-minion- /]# cd /etc/salt/
[root@salt-minion- salt]#mv minion_id minion_id.bak
[root@salt-minion- salt]# mv pki pki.bak
[root@salt-minion- salt]# /etc/init.d/salt-minion restart
Stopping salt-minion daemon: [ OK ]
Starting salt-minion daemon: [ OK ]
[root@salt-minion- salt]# ls
minion minion.d minion_id minion_id.bak pki pki.bak

查看minion的日志信息

error :salt主缓存节点的公钥,这盐奴才将等待10秒前试图认证

[root@salt-minion- salt]# tail /var/log/salt/minion
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate

在master端重新认证(可能存在延迟、多刷新几次)

[root@salt-server master]# salt-key -L
Accepted Keys:
salt-client-
Denied Keys:
Unaccepted Keys:
salt-client-
salt-minion-
Rejected Keys:
[root@salt-server master]# salt-key -a 'salt-minion-01' -y
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion-
Key for minion salt-minion- accepted.
[root@salt-server master]# salt-key -L
Accepted Keys:
salt-client-
salt-minion-
Denied Keys:
Unaccepted Keys:
salt-client-
Rejected Keys:
[root@salt-server master]# salt '*' test.ping
salt-minion-:
True
salt-client-:
True

上面用salt-key -L 查看到salt-client-01在等待认证,是因为缓存的原因

[root@salt-server master]# pwd
/etc/salt/pki/master
[root@salt-server master]# ll minions #通过认证的key
total
-rw-r--r--. root root Sep : salt-client-
-rw-r--r--. root root Sep : salt-minion-
[root@salt-server master]# ll minions_pre 等待认证的key
total
-rw-r--r--. root root Sep : salt-client-
[root@salt-server master]# cd minions_pre
[root@salt-server minions_pre]# ls
salt-client- #把它删除 再次查看就不会存在了
[root@salt-server minions_pre]# rm -rf salt-client-
[root@salt-server minions_pre]# ls
[root@salt-server minions_pre]# salt-key -L
Accepted Keys:
salt-client-
salt-minion-
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@salt-server minions_pre]# salt-key -L
Accepted Keys:
salt-client-
salt-minion-
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@salt-server minions_pre]# salt '*' test.ping
salt-minion-:
True
salt-client-:
True
[root@salt-server minions_pre]# salt '*' cmd.run 'df -h'
salt-minion-:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 18G 917M 16G % /
tmpfs 495M 12K 495M % /dev/shm
/dev/sda1 485M 31M 429M % /boot
salt-client-:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 18G 916M 16G % /
tmpfs 495M 12K 495M % /dev/shm
/dev/sda1 485M 31M 429M % /boot

saltstack(主机改名)的更多相关文章

  1. saltstack主机管理项目:主机管理项目架构设计(二)

    1.salt架构图 https://docs.saltstack.com/en/getstarted/system/plugins.html plug-ins(左边):场景可插拔 subsystem- ...

  2. saltstack主机管理项目【day23】:主机管理项目需求分析-设计

    本节内容 一. 主机管理项目需求分析 二 .主机管理项目架构设计 三.主机管理项目初始构建 四. 主机管理项目编主机分发器 一. 主机管理项目需求分析 场景:我现在又一台裸机要实现一下人物 配置管理: ...

  3. saltstack主机管理项目:编写插件基类-获取主机列表-提取yaml配置文件(四)

    一.编写插件基类 1.目录结构 1.我是如何获知我有多少种系统? 当客户端第一连接过来的时候,我就已经把这些文件存下来了 ,存在到哪里了?存到数据库了 每次对主机发送命令的动作时,我从库里把数据取出来 ...

  4. saltstack主机管理项目:今日总结(六)

    一.总目录 二.具体代码 salt #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:luoahong import os,sys if __ ...

  5. saltstack主机管理项目【day39】:主机管理项目开发

    项目目标 salt state.apply -h "ubuntu,centos" -g "ubuntu,centos" -f "ubuntu,cent ...

  6. saltstack主机管理项目:主机管理项目需求分析(一)

    1.场景: 我现在又一台裸机要实现一下任务 2.配置管理: 1.装上nginx,mysql 2.nginx用我指定的配置文件 3.mysql用户 4.设置一个默认的数据库访问权限 5.启动mysql ...

  7. saltstack主机管理项目:计主机管理项目命令分发器(三)

    一.开发目标命令格式如下: 二.目录结构 三.代码注解 01.salt.py 只是一个入口,没干什么事情 #!/usr/bin/env python # -*- coding:utf-8 -*- # ...

  8. saltstack主机管理项目:动态调用插件解析-模块解析(五)

    一.动态调用插件解析 1.目录结构 1.base_module代码解析: def syntax_parser(self,section_name,mod_name,mod_data): print(& ...

  9. RabbitMQ、RPC、SaltStack "贡"具的使用

    消息队列 使用队列的场景 在程序系统中,例如外卖系统,订单系统,库存系统,优先级较高 发红包,发邮件,发短信,app消息推送等任务优先级很低,很适合交给消息队列去处理,以便于程序系统更快的处理其他请求 ...

随机推荐

  1. 第3章 Linux常用命令(5)_网络命令和挂载命令

    7. 网络命令 7.1 给用户发信息,以ctr+D保存结束 (1)write命令 命令名称 write 命令所在路径 /user/bin/write 执行权限 所有用户 语法 write <用户 ...

  2. PHP实现多图片上传

    PHP实现多图片上传 今天在工作中遇到了一个需求:一个表单实现多个上传图片,类似于QQ空间上传照片的模式.即:可以一次性上传多个图片,但是封面图片只有一个. 最先,最重要的事,在服务器上对文件进行读写 ...

  3. 最新版CentOS6.5上安装部署ASP.NET MVC4和WebApi

    最新版CentOS6.5上安装部署ASP.NET MVC4和WebApi 使用Jexus5.8.1独立版 http://www.linuxdot.net/ ps:该“独立版”支持64位的CentOS ...

  4. 微信小程序之ES6与事项助手

    由于官方IDE更新到了0.11.112301版本,移除了对Promise的支持,造成事项助手不能正常运行,解决此问题,在项目中引入第三方兼容库Bluebird支持Promise,代码已经整合到项目代码 ...

  5. greenDao:操作数据库的开源框架

    greenDAO: Android ORM for your SQLite database 1. greenDao库获取 英文标题借鉴的是greendrobot官网介绍greenDao时给出的Tit ...

  6. 【JavaScript】javascript 方法 test()

    个人理解:var b = x.test(y); y是否存在模式x中,返回true或false:x可以是正则,字符串,

  7. 小程序实现sql插入语句转换成Laravel迁移语句

    sql的插入语句长这样: INSERT INTO `media` (`MediaID`, `type`, `filename`, `title`) VALUES (1, 'word', 'word1. ...

  8. Ubuntu16.04/LinuxMint18安装openjdk-7-jdk

    LinuxMint18的安装源已经默认没有openjdk7了,所以要自己手动添加仓库,如下: sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-ge ...

  9. bzoj2555: SubString

    SAM+LCT维护parent tree版本 虽然说子树维护那套理论需要ETT 不过parent tree的根是固定的,所以用lct加一些奇怪的乱搞就行了 //随手拖个SAM的板子和LCT的板子,然后 ...

  10. sublimetext调试

    Package Control Sublime Text提供了绝对必要的包管理器.这是安装下面列出的所有插件和主题的最佳方式.继续,在包控制在安装插件. 进入命令面板(ctrl + shift+ p) ...