本文介绍在Ubuntu 18.04、CentOS 7操作系统中把Chef Server升级到最新版本的方法,目前的最新版本是Chef Server 12.18.14,如果你使用其它的版本,请按下面的方法升级到12.18.14版。
一、备份Chef Server数据 1、运行以下命令以确保所有服务都处于正常状态并备份所有Chef数据: $ chef-server-ctl reconfigure 2、备份数据: # chef-server-ctl backup --yes Locating rsync.. /bin/rsync Starting Chef Server backup Bringing down the Chef Server ok: down: bookshelf: 1s, normally up ok: down: nginx: 0s, normally up ok: down: oc_bifrost: 0s, normally up ok: down: oc_id: 0s, normally up ok: down: opscode-chef-mover: 302s, normally up ok: down: opscode-erchef: 0s, normally up ok: down: opscode-expander: 1s, normally up ok: down: opscode-solr4: 0s, normally up ok: down: rabbitmq: 0s, normally up ok: down: redis_lb: 0s, normally up Dumping Postgresql database to /tmp/chef_backup20190126-11018-1r60p82/chef_backup-2019-01-26-14-44-09.sql could not change directory to "/tmp/d20190126-11018-1jnkroq": Permission denied ok: down: postgresql: 0s, normally up Writing backup manifest Creating backup tarball /opt/opscode/embedded/lib/ruby/gems/2.5.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout/unix.rb:185: warning: conflicting chdir during another chdir block tar: Removing leading `/' from member names Bringing up the Chef Server ok: run: bookshelf: (pid 11293) 0s ok: run: nginx: (pid 11372) 1s ok: run: oc_bifrost: (pid 11386) 1s ok: run: oc_id: (pid 11467) 0s ok: run: opscode-chef-mover: (pid 11482) 0s ok: run: opscode-erchef: (pid 11559) 0s ok: run: opscode-expander: (pid 11911) 0s ok: run: opscode-solr4: (pid 12052) 0s ok: run: postgresql: (pid 12090) 0s ok: run: rabbitmq: (pid 11561) 13s ok: run: redis_lb: (pid 12357) 1s Exporting tarball to /var/opt/chef-backup Cleaning up /tmp/chef_backup20190126-11018-1r60p82 Backup Complete! 3、确认备份文件: # ls /var/opt/chef-backup/ chef-backup-2019-01-26-14-44-09.tgz 至此,备份操作完成。同时可以参考备份Linux操作系统的数据到坚果云的方法。
二、下载并升级Chef Server到最新版本 1、Chef Server下载页面,当前最新版本Chef Server 12.18.14,在终端中下载: wget https://packages.chef.io/files/stable/chef-server/12.18.14/el/7/chef-server-core-12.18.14-1.el7.x86_64.rpm 2、下载软件包后,请与软件包管理器一起安装: sudo yum localinstall <package.rpm> 对于Ubuntu系统,请使用: sudo dpkg -i <package.deb> 3、输出如下信息: Running transaction Updating: chef-server-core-12.18.14-1.el7.x86_64 [#####################] 1/ Updating: chef-server-core-12.18.14-1.el7.x86_64 [#####################] 1/ Updating: chef-server-core-12.18.14-1.el7.x86_64 [#####################] 1/ Upda Updating: chef-server-core-12.18.14-1.el7.x86_64 1/2 You have upgraded Chef Server! ...... For detailed upgrade instructions please see: https://docs.chef.io/upgrade_server.html Cleanup : chef-server-core-12.17.33-1.el7.x86_64 2/2 warning: file /opt/opscode/embedded/service/oc_id/log/development.log: remove failed: No such file or directory Verifying : chef-server-core-12.18.14-1.el7.x86_64 1/2 Verifying : chef-server-core-12.17.33-1.el7.x86_64 Updated: chef-server-core.x86_64 0:12.18.14-1.el7 Complete! 4、升级过程的下一步是运行: $ sudo chef-server-ctl upgrade 5、升级命令完成后,Chef服务将保持关闭状态,为了让他们恢复运行: $ sudo sudo chef-server-ctl start ok: run: bookshelf: (pid 14176) 1s ok: run: nginx: (pid 14233) 0s ok: run: oc_bifrost: (pid 14255) 1s ok: run: oc_id: (pid 14289) 0s ok: run: opscode-chef-mover: (pid 14332) 0s ok: run: opscode-erchef: (pid 14335) 1s ok: run: opscode-expander: (pid 14475) 0s ok: run: opscode-solr4: (pid 14705) 0s ok: run: postgresql: (pid 14145) 189s ok: run: rabbitmq: (pid 14337) 1s ok: run: redis_lb: (pid 15079) 1s 6、最后,删除内部服务使用的配置文件、日志、目录、用户等,并从此版本的Chef Server中删除: $ sudo chef-server-ctl cleanup 同时你可以添加--no-op选项以查看此命令将删除的内容。 至此,升级Chef Server操作结束。
相关主题 |