[root@cu2 ~]# kubectl create namespace test3 namespace "test3" created [root@cu2 ~]# kubectl run hadoop3 --image=cu.eshore.cn/library/java:jdk8 --replicas=3 --namespace=test3 -- /usr/sbin/sshd -D deployment "hadoop3" created [root@cu2 ~]# kubectl get pods -o wide --namespace=test3 | grep -v IP | awk '{print $6" "$1}' 10.1.93.5 hadoop3-1569171836-11z58 10.1.40.5 hadoop3-1569171836-9194q 10.1.24.3 hadoop3-1569171836-jlq3t [root@cu2 ~]# ssh root@10.1.93.5 root@10.1.93.5's password: Last login: Sat May 6 11:45:46 2017 from 10.1.51.0 [root@hadoop3-1569171836-11z58 ~]# [root@hadoop3-1569171836-11z58 ~]# cat >/etc/profile.d/jdk.sh < > ## Usage $0 [user@]host password > > set host [lrange $argv 0 0]; > set password [lrange $argv 1 1] ; > > set timeout 30; > > spawn ssh-copy-id $host ; > > expect { > "(yes/no)?" { send yes\n; exp_continue; } > "password:" { send $password\n; exp_continue; } > } > > exec sleep 1; > > ' >ssh-copy-id.expect [root@hadoop3-1569171836-11z58 ~]# chmod +x ssh-copy-id.expect [root@hadoop3-1569171836-11z58 ~]# cat >>/etc/hosts < 10.1.93.5 hadoop3-1569171836-11z58 > 10.1.40.5 hadoop3-1569171836-9194q > 10.1.24.3 hadoop3-1569171836-jlq3t > EOF [root@hadoop3-1569171836-11z58 ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: 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: 9c:28:3e:15:f6:95:24:ec:68:54:e7:ef:ad:53:f5:67 root@hadoop3-1569171836-11z58 The key's randomart image is: +--[ RSA 2048]----+ | oo o | | . .= . | | .oo + | | .o=.o . .| | ..o S . ..| | . o . .. E| | o .....| | . .. | | .. | +-----------------+ [root@hadoop3-1569171836-11z58 ~]# for h in ` cat /etc/hosts | grep hadoop3 | awk '{print $2}' | sort -u ` ; do ./ssh-copy-id.expect "$h" root; done spawn ssh-copy-id hadoop3-1569171836-11z58 The authenticity of host 'hadoop3-1569171836-11z58 (10.1.93.5)' can't be established. RSA key fingerprint is 03:d2:27:5f:aa:79:47:c0:2c:fc:6f:0a:40:7f:e9:f7. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'hadoop3-1569171836-11z58,10.1.93.5' (RSA) to the list of known hosts. root@hadoop3-1569171836-11z58's password: Now try logging into the machine, with "ssh 'hadoop3-1569171836-11z58'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. ... [root@hadoop3-1569171836-11z58 ~]# ssh hadoop3-1569171836-9194q Last login: Thu Aug 6 08:59:43 2015 from 172.17.42.1 [root@hadoop3-1569171836-9194q ~]# ---30 [root@cu2 docker]# kubectl get deployments -n test3 NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE hadoop3 3 3 3 3 14m [root@cu2 docker]# kubectl scale --replicas=30 deployment hadoop3 -n test3 deployment "hadoop3" scaled [root@cu2 docker]# [root@cu2 docker]# kubectl get pods -n test3 NAME READY STATUS RESTARTS AGE hadoop3-1569171836-11z58 1/1 Running 0 15m hadoop3-1569171836-1f1cj 1/1 Running 0 31s hadoop3-1569171836-1nhjx 1/1 Running 0 31s hadoop3-1569171836-32k0x 1/1 Running 0 31s hadoop3-1569171836-368mb 1/1 Running 0 31s hadoop3-1569171836-616m7 1/1 Running 0 31s hadoop3-1569171836-65hbc 1/1 Running 0 31s hadoop3-1569171836-89mss 1/1 Running 0 31s hadoop3-1569171836-8lsn7 1/1 Running 0 31s hadoop3-1569171836-9194q 1/1 Running 0 15m hadoop3-1569171836-98wrs 1/1 Running 0 31s hadoop3-1569171836-9f104 1/1 Running 0 31s hadoop3-1569171836-9wvd8 1/1 Running 0 31s hadoop3-1569171836-c5j9g 1/1 Running 0 31s hadoop3-1569171836-fx5dc 1/1 Running 0 31s hadoop3-1569171836-ggqst 1/1 Running 0 31s hadoop3-1569171836-jlq3t 1/1 Running 0 15m hadoop3-1569171836-jvht8 1/1 Running 0 31s hadoop3-1569171836-jwchm 1/1 Running 0 31s hadoop3-1569171836-kkgxw 1/1 Running 0 31s hadoop3-1569171836-ktn14 1/1 Running 0 31s hadoop3-1569171836-kx7xw 1/1 Running 0 31s hadoop3-1569171836-m0lwr 1/1 Running 0 31s hadoop3-1569171836-n1l7l 1/1 Running 0 31s hadoop3-1569171836-nd2pd 1/1 Running 0 31s hadoop3-1569171836-ptvq6 1/1 Running 0 31s hadoop3-1569171836-rnkz1 1/1 Running 0 31s hadoop3-1569171836-tg9mw 1/1 Running 0 31s hadoop3-1569171836-wgfwm 1/1 Running 0 31s hadoop3-1569171836-zgctj 1/1 Running 0 31s --PUPPET [root@cu2 html]# kubectl get pods -o wide --namespace=test3 | grep -v IP | awk '{print $6" "$1}' 10.1.93.5 hadoop3-1569171836-11z58 10.1.24.8 hadoop3-1569171836-1f1cj 10.1.51.10 hadoop3-1569171836-1nhjx 10.1.93.10 hadoop3-1569171836-32k0x 10.1.20.4 hadoop3-1569171836-368mb 10.1.93.8 hadoop3-1569171836-616m7 10.1.20.5 hadoop3-1569171836-65hbc 10.1.24.6 hadoop3-1569171836-89mss 10.1.24.4 hadoop3-1569171836-8lsn7 10.1.40.5 hadoop3-1569171836-9194q 10.1.40.6 hadoop3-1569171836-98wrs 10.1.40.11 hadoop3-1569171836-9f104 10.1.51.13 hadoop3-1569171836-9wvd8 10.1.20.8 hadoop3-1569171836-c5j9g 10.1.40.8 hadoop3-1569171836-fx5dc 10.1.24.7 hadoop3-1569171836-ggqst 10.1.24.3 hadoop3-1569171836-jlq3t 10.1.93.9 hadoop3-1569171836-jvht8 10.1.40.9 hadoop3-1569171836-jwchm 10.1.20.9 hadoop3-1569171836-kkgxw 10.1.93.7 hadoop3-1569171836-ktn14 10.1.24.5 hadoop3-1569171836-kx7xw 10.1.20.6 hadoop3-1569171836-m0lwr 10.1.40.10 hadoop3-1569171836-n1l7l 10.1.51.11 hadoop3-1569171836-nd2pd 10.1.51.9 hadoop3-1569171836-ptvq6 10.1.93.6 hadoop3-1569171836-rnkz1 10.1.20.7 hadoop3-1569171836-tg9mw 10.1.40.7 hadoop3-1569171836-wgfwm 10.1.51.12 hadoop3-1569171836-zgctj [root@hadoop3-1569171836-11z58 ~]# vi /etc/hosts ... [root@hadoop3-1569171836-11z58 yum.repos.d]# cat >puppet.repo < [puppet] > name=puppet 4.4 > baseurl=http://192.168.0.214:801/puppet > enabled=1 > gpgcheck=0 > EOF [root@hadoop3-1569171836-11z58 yum.repos.d]# [root@hadoop3-1569171836-11z58 yum.repos.d]# yum install puppetserver Loaded plugins: fastestmirror Setting up Install Process Loading mirror speeds from cached hostfile * base: mirrors.zju.edu.cn * extras: mirrors.zju.edu.cn * updates: mirrors.zju.edu.cn puppet | 2.9 kB 00:00 puppet/primary_db | 7.1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package puppetserver.noarch 0:2.3.1-1.el6 will be installed --> Processing Dependency: puppet-agent >= 1.4.0 for package: puppetserver-2.3.1-1.el6.noarch --> Processing Dependency: java-1.8.0-openjdk-headless for package: puppetserver-2.3.1-1.el6.noarch --> Running transaction check ---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.131-0.b11.el6_9 will be installed --> Processing Dependency: tzdata-java >= 2014f-1 for package: 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 --> Processing Dependency: nss >= 3.28.4 for package: 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 --> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 --> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 --> Processing Dependency: libjpeg.so.62()(64bit) for package: 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 --> Processing Dependency: libfreetype.so.6()(64bit) for package: 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 ---> Package puppet-agent.x86_64 0:1.4.1-1.el6 will be installed --> Running transaction check ---> Package freetype.x86_64 0:2.3.11-17.el6 will be installed ---> Package jpackage-utils.noarch 0:1.7.5-3.16.el6 will be installed ---> Package libjpeg-turbo.x86_64 0:1.2.1-3.el6_5 will be installed ---> Package nss.x86_64 0:3.18.0-5.3.el6_6 will be updated --> Processing Dependency: nss = 3.18.0-5.3.el6_6 for package: nss-sysinit-3.18.0-5.3.el6_6.x86_64 --> Processing Dependency: nss(x86-64) = 3.18.0-5.3.el6_6 for package: nss-tools-3.18.0-5.3.el6_6.x86_64 ---> Package nss.x86_64 0:3.28.4-1.el6_9 will be an update --> Processing Dependency: nss-util >= 3.28.3 for package: nss-3.28.4-1.el6_9.x86_64 --> Processing Dependency: nspr >= 4.13.0 for package: nss-3.28.4-1.el6_9.x86_64 --> Processing Dependency: libnssutil3.so(NSSUTIL_3.24)(64bit) for package: nss-3.28.4-1.el6_9.x86_64 --> Processing Dependency: libnssutil3.so(NSSUTIL_3.21)(64bit) for package: nss-3.28.4-1.el6_9.x86_64 ---> Package tzdata-java.noarch 0:2017b-1.el6 will be installed --> Running transaction check ---> Package nspr.x86_64 0:4.10.8-1.el6_6 will be updated ---> Package nspr.x86_64 0:4.13.1-1.el6 will be an update ---> Package nss-sysinit.x86_64 0:3.18.0-5.3.el6_6 will be updated ---> Package nss-sysinit.x86_64 0:3.28.4-1.el6_9 will be an update ---> Package nss-tools.x86_64 0:3.18.0-5.3.el6_6 will be updated ---> Package nss-tools.x86_64 0:3.28.4-1.el6_9 will be an update ---> Package nss-util.x86_64 0:3.18.0-1.el6_6 will be updated ---> Package nss-util.x86_64 0:3.28.4-1.el6_9 will be an update --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================================================================================== Package Arch Version Repository Size =========================================================================================================================================================================================== Installing: puppetserver noarch 2.3.1-1.el6 puppet 32 M Installing for dependencies: freetype x86_64 2.3.11-17.el6 base 361 k java-1.8.0-openjdk-headless x86_64 1:1.8.0.131-0.b11.el6_9 updates 32 M jpackage-utils noarch 1.7.5-3.16.el6 base 60 k libjpeg-turbo x86_64 1.2.1-3.el6_5 base 174 k puppet-agent x86_64 1.4.1-1.el6 puppet 26 M tzdata-java noarch 2017b-1.el6 updates 183 k Updating for dependencies: nspr x86_64 4.13.1-1.el6 base 114 k nss x86_64 3.28.4-1.el6_9 updates 880 k nss-sysinit x86_64 3.28.4-1.el6_9 updates 51 k nss-tools x86_64 3.28.4-1.el6_9 updates 446 k nss-util x86_64 3.28.4-1.el6_9 updates 68 k Transaction Summary =========================================================================================================================================================================================== Install 7 Package(s) Upgrade 5 Package(s) Total download size: 91 M Is this ok [y/N]: y Downloading Packages: (1/12): freetype-2.3.11-17.el6.x86_64.rpm | 361 kB 00:00 (2/12): java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64.rpm | 32 MB 00:01 (3/12): jpackage-utils-1.7.5-3.16.el6.noarch.rpm | 60 kB 00:00 (4/12): libjpeg-turbo-1.2.1-3.el6_5.x86_64.rpm | 174 kB 00:00 (5/12): nspr-4.13.1-1.el6.x86_64.rpm | 114 kB 00:00 (6/12): nss-3.28.4-1.el6_9.x86_64.rpm | 880 kB 00:00 (7/12): nss-sysinit-3.28.4-1.el6_9.x86_64.rpm | 51 kB 00:00 (8/12): nss-tools-3.28.4-1.el6_9.x86_64.rpm | 446 kB 00:00 (9/12): nss-util-3.28.4-1.el6_9.x86_64.rpm | 68 kB 00:00 (10/12): puppet-agent-1.4.1-1.el6.x86_64.rpm | 26 MB 00:00 (11/12): puppetserver-2.3.1-1.el6.noarch.rpm | 32 MB 00:01 (12/12): tzdata-java-2017b-1.el6.noarch.rpm | 183 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 23 MB/s | 91 MB 00:03 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Updating : nspr-4.13.1-1.el6.x86_64 1/17 Updating : nss-util-3.28.4-1.el6_9.x86_64 2/17 Updating : nss-3.28.4-1.el6_9.x86_64 3/17 Updating : nss-sysinit-3.28.4-1.el6_9.x86_64 4/17 Installing : libjpeg-turbo-1.2.1-3.el6_5.x86_64 5/17 Installing : tzdata-java-2017b-1.el6.noarch 6/17 Installing : freetype-2.3.11-17.el6.x86_64 7/17 Installing : puppet-agent-1.4.1-1.el6.x86_64 8/17 Installing : jpackage-utils-1.7.5-3.16.el6.noarch 9/17 Installing : 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 10/17 Installing : puppetserver-2.3.1-1.el6.noarch 11/17 usermod: no changes Updating : nss-tools-3.28.4-1.el6_9.x86_64 12/17 Cleanup : nss-tools-3.18.0-5.3.el6_6.x86_64 13/17 Cleanup : nss-sysinit-3.18.0-5.3.el6_6.x86_64 14/17 Cleanup : nss-3.18.0-5.3.el6_6.x86_64 15/17 Cleanup : nss-util-3.18.0-1.el6_6.x86_64 16/17 Cleanup : nspr-4.10.8-1.el6_6.x86_64 17/17 Verifying : nss-tools-3.28.4-1.el6_9.x86_64 1/17 Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64 2/17 Verifying : jpackage-utils-1.7.5-3.16.el6.noarch 3/17 Verifying : puppet-agent-1.4.1-1.el6.x86_64 4/17 Verifying : freetype-2.3.11-17.el6.x86_64 5/17 Verifying : nspr-4.13.1-1.el6.x86_64 6/17 Verifying : nss-3.28.4-1.el6_9.x86_64 7/17 Verifying : nss-util-3.28.4-1.el6_9.x86_64 8/17 Verifying : tzdata-java-2017b-1.el6.noarch 9/17 Verifying : puppetserver-2.3.1-1.el6.noarch 10/17 Verifying : libjpeg-turbo-1.2.1-3.el6_5.x86_64 11/17 Verifying : nss-sysinit-3.28.4-1.el6_9.x86_64 12/17 Verifying : nss-3.18.0-5.3.el6_6.x86_64 13/17 Verifying : nspr-4.10.8-1.el6_6.x86_64 14/17 Verifying : nss-tools-3.18.0-5.3.el6_6.x86_64 15/17 Verifying : nss-sysinit-3.18.0-5.3.el6_6.x86_64 16/17 Verifying : nss-util-3.18.0-1.el6_6.x86_64 17/17 Installed: puppetserver.noarch 0:2.3.1-1.el6 Dependency Installed: freetype.x86_64 0:2.3.11-17.el6 java-1.8.0-openjdk-headless.x86_64 1:1.8.0.131-0.b11.el6_9 jpackage-utils.noarch 0:1.7.5-3.16.el6 libjpeg-turbo.x86_64 0:1.2.1-3.el6_5 puppet-agent.x86_64 0:1.4.1-1.el6 tzdata-java.noarch 0:2017b-1.el6 Dependency Updated: nspr.x86_64 0:4.13.1-1.el6 nss.x86_64 0:3.28.4-1.el6_9 nss-sysinit.x86_64 0:3.28.4-1.el6_9 nss-tools.x86_64 0:3.28.4-1.el6_9 nss-util.x86_64 0:3.28.4-1.el6_9 Complete! [root@hadoop3-1569171836-11z58 yum.repos.d]# [root@hadoop3-1569171836-11z58 yum.repos.d]# su - [root@hadoop3-1569171836-11z58 ~]# [root@hadoop3-1569171836-11z58 ~]# puppet -V 4.4.1 [root@hadoop3-1569171836-11z58 ~]# jps -m 273 main -m puppetlabs.trapperkeeper.main --config /etc/puppetlabs/puppetserver/conf.d -b /etc/puppetlabs/puppetserver/bootstrap.cfg 882 Jps -m [root@hadoop3-1569171836-11z58 ~]# vi /etc/puppetlabs/puppet/puppet.conf [master] ... autosign = true [main] certname=hadoop3-1569171836-11z58 [agent] server=hadoop3-1569171836-11z58 [root@hadoop3-1569171836-11z58 ~]# service puppetserver restart [root@hadoop3-1569171836-11z58 ~]# cd /etc/puppetlabs/code/environments/production/manifests/ [root@hadoop3-1569171836-11z58 manifests]# vi site.pp notify { 'greeting': message => 'Hello World', } "site.pp" [New] 3L, 51C written [root@hadoop3-1569171836-11z58 manifests]# puppet agent -t Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for hadoop3-1569171836-11z58 Info: Applying configuration version '1494074493' Notice: Hello World Notice: /Stage[main]/Main/Notify[greeting]/message: defined 'message' as 'Hello World' Notice: Applied catalog in 0.02 seconds [root@hadoop3-1569171836-11z58 manifests]# [root@hadoop3-1569171836-11z58 ~]# wget http://192.168.0.214:8880/share/download/apache-activemq-5.13.2-bin.tar.gz [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# bin/activemq start INFO: Loading '/root/apache-activemq-5.13.2//bin/env' INFO: Using java '/opt/jdk1.8.0_121/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/root/apache-activemq-5.13.2//data/activemq.pid' (pid '2307') [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# jps 1649 main 2355 Jps 2307 activemq.jar [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# vi /etc/puppetlabs/mcollective/server.cfg plugin.psk = unset connector = activemq plugin.activemq.pool.size = 1 plugin.activemq.pool.1.host = hadoop3-1569171836-11z58 plugin.activemq.pool.1.port = 61613 plugin.activemq.pool.1.user = system plugin.activemq.pool.1.password = manager # Facts factsource = yaml plugin.yaml = /etc/puppetlabs/mcollective/facts.yaml plugin.puppet.command = /opt/puppetlabs/bin/puppet agent plugin.puppet.config = /etc/puppetlabs/puppet/puppet.conf [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# vi /etc/puppetlabs/mcollective/client.cfg connector = activemq plugin.activemq.pool.size = 1 plugin.activemq.pool.1.host = hadoop3-1569171836-11z58 plugin.activemq.pool.1.port = 61613 plugin.activemq.pool.1.user = system plugin.activemq.pool.1.password = manager connection_timeout = 3 [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# mco ping hadoop3-1569171836-11z58 time=31.65 ms ---- ping statistics ---- 1 replies max: 31.65 min: 31.65 avg: 31.65 [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# mco The Marionette Collective version 2.8.8 usage: /opt/puppetlabs/bin/mco command Known commands: completion describe_filter facts find help inventory ping plugin rpc Type '/opt/puppetlabs/bin/mco help' for a detailed list of commands and '/opt/puppetlabs/bin/mco help command' to get detailed help for a command [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# yum install mcollective-plugins-simple -y Loaded plugins: fastestmirror Setting up Install Process Determining fastest mirrors * base: mirrors.zju.edu.cn * extras: mirrors.hust.edu.cn * updates: mirrors.hust.edu.cn base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:00 extras | 3.4 kB 00:00 extras/primary_db | 37 kB 00:00 puppet | 2.9 kB 00:00 puppet/primary_db | 7.5 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 803 kB 00:01 Resolving Dependencies --> Running transaction check ---> Package mcollective-plugins-simple.noarch 0:4.4.1-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================================================================================== Package Arch Version Repository Size =========================================================================================================================================================================================== Installing: mcollective-plugins-simple noarch 4.4.1-1.el6 puppet 75 k Transaction Summary =========================================================================================================================================================================================== Install 1 Package(s) Total download size: 75 k Installed size: 331 k Downloading Packages: mcollective-plugins-simple-4.4.1-1.el6.noarch.rpm | 75 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mcollective-plugins-simple-4.4.1-1.el6.noarch 1/1 Verifying : mcollective-plugins-simple-4.4.1-1.el6.noarch 1/1 Installed: mcollective-plugins-simple.noarch 0:4.4.1-1.el6 Complete! [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# mco The Marionette Collective version 2.8.8 usage: /opt/puppetlabs/bin/mco command Known commands: completion describe_filter facts find help inventory package ping plugin puppet rpc service shell Type '/opt/puppetlabs/bin/mco help' for a detailed list of commands and '/opt/puppetlabs/bin/mco help command' to get detailed help for a command [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# service mcollective restart Shutting down mcollective: [ OK ] Starting mcollective: [ OK ] [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# [root@hadoop3-1569171836-11z58 apache-activemq-5.13.2]# mco shell run -- hostname * [ ============================================================> ] 1 / 1 hadoop3-1569171836-11z58: hadoop3-1569171836-11z58 Finished processing 1 / 1 hosts in 164.03 ms -- 注释掉一部分由于docker限制 [root@hadoop3-1569171836-11z58 ~]# vi prepare.sh #!/bin/sh # must be hostname!! HOSTS="$@" PASSWD='root' PUPPETSERVER="hadoop3-1569171836-11z58" for h in $HOSTS ; do ./ssh-copy-id.expect $h "$PASSWD" ; done for h in $HOSTS ; do scp /etc/hosts $h:/etc ; scp /etc/yum.repos.d/puppet.repo $h:/etc/yum.repos.d/ ; #scp /etc/cron.daily/ntp.cron $h:/etc/cron.daily/ ; ssh $h ' #ntpdate cu-omc1 rm -rf /etc/yum.repos.d/CentOS-* yum install mcollective-plugins-simple -y ' ; scp /etc/puppetlabs/mcollective/server.cfg $h:/etc/puppetlabs/mcollective/ ssh $h " sed -i '/HOSTNAME/ { i \ HOSTNAME=$h d } ' /etc/sysconfig/network #hostname $h echo -e '\n\n[agent]\nserver = $PUPPETSERVER\ncertname=$h' > /etc/puppetlabs/puppet/puppet.conf chkconfig mcollective on service mcollective start " done [root@hadoop3-1569171836-11z58 ~]# ./prepare.sh $(grep hadoop3 /etc/hosts | awk '{print $2}') spawn ssh-copy-id hadoop3-1569171836-11z58 Now try logging into the machine, with "ssh 'hadoop3-1569171836-11z58'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. ... hosts 100% 1241 1.2KB/s 00:00 puppet.repo 100% 86 0.1KB/s 00:00 Loaded plugins: fastestmirror Setting up Install Process Determining fastest mirrors Resolving Dependencies --> Running transaction check ---> Package mcollective-plugins-simple.noarch 0:4.4.1-1.el6 will be installed --> Processing Dependency: puppet-agent >= 1.4.1 for package: mcollective-plugins-simple-4.4.1-1.el6.noarch --> Running transaction check ---> Package puppet-agent.x86_64 0:1.4.1-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mcollective-plugins-simple noarch 4.4.1-1.el6 puppet 75 k Installing for dependencies: puppet-agent x86_64 1.4.1-1.el6 puppet 26 M Transaction Summary ================================================================================ Install 2 Package(s) Total download size: 26 M Installed size: 133 M Downloading Packages: -------------------------------------------------------------------------------- Total 107 MB/s | 26 MB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : puppet-agent-1.4.1-1.el6.x86_64 1/2 Installing : mcollective-plugins-simple-4.4.1-1.el6.noarch 2/2 Verifying : mcollective-plugins-simple-4.4.1-1.el6.noarch 1/2 Verifying : puppet-agent-1.4.1-1.el6.x86_64 2/2 Installed: mcollective-plugins-simple.noarch 0:4.4.1-1.el6 Dependency Installed: puppet-agent.x86_64 0:1.4.1-1.el6 Complete! server.cfg 100% 878 0.9KB/s 00:00 Starting mcollective: [ OK ] ... [root@hadoop3-1569171836-11z58 ~]# for h in $(grep hadoop3 /etc/hosts | awk '{print $2}') ;do echo $h ;done | wc -l 30 [root@hadoop3-1569171836-11z58 ~]# for h in $(grep hadoop3 /etc/hosts | awk '{print $2}') ;do ssh $h service mcollective restart ;done Shutting down mcollective: [ OK ] Starting mcollective: [ OK ] ... 这里重启是因为有6台一直连不上,由于cu4机器时间不对上面6个容器一直没有消息返回。 [root@cu2 puppet]# pdsh -R ssh -w cu[1-5] ntpdate 1.cn.pool.ntp.org cu1: 6 May 21:37:45 ntpdate[19655]: step time server 51.174.171.7 offset -225.093715 sec cu3: 6 May 21:37:46 ntpdate[3603]: step time server 139.162.72.14 offset -206.369795 sec cu4: 6 May 21:37:46 ntpdate[5070]: step time server 139.162.72.14 offset -10.419821 sec cu2: 6 May 21:37:46 ntpdate[51615]: adjust time server 51.174.171.7 offset -0.000000 sec cu5: 6 May 21:37:46 ntpdate[38314]: step time server 51.174.171.7 offset -187.003178 sec [root@hadoop3-1569171836-11z58 ~]# mco ping hadoop3-1569171836-368mb time=44.02 ms hadoop3-1569171836-32k0x time=83.02 ms hadoop3-1569171836-65hbc time=83.66 ms hadoop3-1569171836-11z58 time=84.20 ms hadoop3-1569171836-1f1cj time=84.68 ms hadoop3-1569171836-8lsn7 time=85.14 ms hadoop3-1569171836-616m7 time=85.62 ms hadoop3-1569171836-1nhjx time=86.06 ms hadoop3-1569171836-89mss time=86.65 ms hadoop3-1569171836-98wrs time=87.10 ms hadoop3-1569171836-ktn14 time=87.65 ms hadoop3-1569171836-c5j9g time=88.07 ms hadoop3-1569171836-jvht8 time=88.58 ms hadoop3-1569171836-jwchm time=89.01 ms hadoop3-1569171836-jlq3t time=89.45 ms hadoop3-1569171836-kkgxw time=89.86 ms hadoop3-1569171836-9194q time=90.32 ms hadoop3-1569171836-ggqst time=90.77 ms hadoop3-1569171836-rnkz1 time=91.20 ms hadoop3-1569171836-9f104 time=91.64 ms hadoop3-1569171836-fx5dc time=92.09 ms hadoop3-1569171836-kx7xw time=92.54 ms hadoop3-1569171836-n1l7l time=93.01 ms hadoop3-1569171836-m0lwr time=93.53 ms hadoop3-1569171836-wgfwm time=94.01 ms hadoop3-1569171836-tg9mw time=94.58 ms hadoop3-1569171836-9wvd8 time=95.08 ms hadoop3-1569171836-nd2pd time=95.55 ms hadoop3-1569171836-ptvq6 time=95.99 ms hadoop3-1569171836-zgctj time=96.44 ms ---- ping statistics ---- 30 replies max: 96.44 min: 44.02 avg: 88.32