How to backup Analytics server

Alex Vinyar -

 

0. Stop analytics on the old server `opscode-analytics-ctl stop`

1. Install RPM on new analytics server

2. On each Chef Server node in the HA cluster (FE and BE)

a. Update chef-server.rb with new IP of the new Analytics box
`sudo vi /etc/opscode/chef-server.rb`

b. Chef-server-ctl stop

c. Chef-server-ctl reconfigure

d. Chef-server-ctl restart

> needed?
e. (on FE) opscode-manage-ctl reconfigure
f. (on FE) opscode-reporting-ctl reconfigure

3. Copy /etc/opscode-analytics from chef server to new analytics server
- /etc/opscode-analytics$ scp * vagrant@192.168.1.44:/tmp

4. Create /etc/opscode-analytics/opscode-analytics.rb on new analytics server
mkdir /etc/opscode-analytics/
cp /tmp/webui_priv.pem /etc/opscode-analytics/
cp /tmp/actions-source.json /etc/opscode-analytics/
touch /etc/opscode-analytics/opscode-analytics.rb
vi /etc/opscode-analytics/opscode-analytics.rb
analytics_fqdn "192.168.1.44"
topology "standalone"


5. make sure `sudo opscode-analytics-ctl preflight-check` passes on the new analytics server

6. `sudo opscode-analytics-ctl reconfigure` (completed successfully) on the new analytics server

7. Dump database on old analytics server

- sudo opscode-analytics-ctl start postgresql
a. sudo su - chef-pgsql
b. /opt/opscode-analytics/embedded/bin/pg_dumpall -c | gzip --fast > /tmp/backup.gz

possible error:
/opt/opscode-analytics/embedded/bin/pg_dumpall -c | gzip --fast > backup.gz
pg_dumpall: could not connect to database "template1": FATAL: no pg_hba.conf entry for host "[local]", user "root", database "template1", SSL off

workaround:
use sudo - chef-pgsql or if you're using a custom user, use the user defined in chef-server.rb to dump db

8. Copy backup.gz to new server
scp backup.gz vagrant@192.168.1.44:/tmp

9. stop the new analytics server
sudo opscode-analytics-ctl stop

10. start postgres on the new analytics server
sudo opscode-analytics-ctl start postgresql

11. impersonate the user with access to postgres (same as above in pgdump)
sudo su - chef-pgsql

12. gunzip -c backup.gz | /opt/opscode-analytics/embedded/bin/psql -U "chef-pgsql" -d postgres
-- (seemed fine other than the expected current user cannot be dropped and role already exists)

13. Copy /opscode-analytics folder from old analytics server to news analytics server
on new server:
mkdir /tmp/analytics

on old server:
scp /etc/opscode-analytics/* vagrant@192.168.1.44:/tmp/analytics

on new server:
sudo cp /tmp/analytics/* /etc/opscode-analytics

14. Update opscode-analytics.rb with IP of the new analytics server
sudo vi /etc/opscode-analytics/opscode-analytics.rb

update the following line with IP of the new analytics server
analytics_fqdn "192.168.1.44"

14. Reconfigure new Analytics server
opscode-analytics-ctl reconfigure

15. restart new analytics server
opscode-analytics-ctl start

source: https://getchef.zendesk.com/agent/tickets/10148

Have more questions? Submit a request

Comments

Powered by Zendesk