In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
System environment: centos6.5
Database version: postgres9.3.9
2 virtual machines:
Master:10.0.2.160
Slave:10.0.2.69
Data storage location: / usr/local/pgsql/data/
For the installation process of pgsql database, please refer to my previous blog: both https://blog.51cto.com/13632960/2117902 machines need to be installed. When I was doing a hot backup, Master database was turned on and Slave was closed. Create a stream to replicate the user's Master side to enter the database and execute: CREATE USER repuser replication PASSWORD 'repuser'; configure the Masterside access file pg_hba.confvim / usr/local/pgsql/data/pg_hba.conf at the end add: host replication repuser 10.0.2.69 hip 16 md5 # md5 as the connection method you can also choose other configuration Masterside configuration file postgresql.conf
Create a folder for archiving files before modification: mkdir / usr/local/pgsql/data/archive
Vim / usr/local/pgsql/data/postgresql.conf
Modify the following: max_wal_senders = 1 wal_level = hot_standbyarchive_mode = on archive_command ='cp% p / usr/local/pgsql/data/archive/%f''hot_standby = onwal_keep_segments = 64 Note: max_wal_senders is the number of nodes in the Slave library Set up as many slave libraries as there are. Wal_level is the parameter value of write ahead log. To set stream replication, be sure to update this value to the default value of hot_standby wal_keep_segments. The default value is 16, which is the number of log files under PG_XLOG. Archive can also be turned off. Archiving is used for regular recovery. Stream replication is not a necessary backup of the main library-Masterside.
Open file backup: / usr/local/pgsql/bin/psql psql (9.3.9) Type "help" for help.postgres=# select pg_start_backup ('backup_1'); package the Master / usr/local/pgsql/data/ directory and send it to the Slave server, excluding the contents of the pg_xlog directory! On the cd / usr/local/pgsql/tar-czvf data.tar.gz data--exclude=data/pg_xlog Slave side, if the postgres database has been installed and the data directory name is the same, you can first stop the standby database, change the data directory name, mv data data.old remotely copy the data directory name to the server, and decompress the scp data.tar.gz postgres@10.0.2.69:/usr/local/pgsql/ copy on the slave side after the copy is completed. Enter the database and close the backup: select pg_stop_backup (), current_timestamp Decompress the Slave and modify the relevant configuration file cd / usr/local/pgsqltar-zxvf data.tar.gzcd / usr/local/pgsql/datamkdir pg_xlog vim / usr/local/pgsql/data/postgresql.conf modify: hot_standby = on backup needs to configure the recovery.conf file, copy and rename the recovery.conf.sample in the share directory. After the cp / usr/local/pgsql/share/recovery.conf.sample / usr/local/pgsql/data/recovery.conf replication is completed, modify the following content: standby_mode = 'on'primary_conninfo =' host=10.0.2.69 port=5432 user=repuser password=repuser keepalives_idle=60' starts the Slave library to start the standby library normally. If there is any exception, please see log/usr/local/pgsql/bin/pg_ctl start-D / usr/local/pgsql/data > > logfile 2 > & 1 to check the startup status of the master library and slave library.
Master:
Slave:
At this point, the hot backup solution for postgresql stream replication has been deployed. You can insert data or build a table to test the availability of the feature through navicat or command line.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Installation and configuration of MogileFS = = Overview: =
© 2024 shulou.com SLNews company. All rights reserved.