(Linux)Postgres10版本主从复制实现数据迁移_pg数据库怎么迁移 linux

操作系统:Centos7.4
主节点:docker-slave-79101
从节点:docker-slave-79102
安装包:postgres-10.3

注意主从节点的安装路径要保持一致!

主节点操作

[root@docker-slave-79101 ~]# ll
total 95280
-rw-------. 1 root root     1831 Jul 16 16:54 anaconda-ks.cfg
drwxr-xr-x. 3 root root      107 Aug  3 11:36 Postgres-10.12.1v-20200803
-rw-r--r--. 1 root root 47562657 Aug  3 11:36 Postgres-10.12.1v-20200803.tar.gz
drwxr-xr-x. 2 root root      100 Aug  3 11:25 Postgres-12.3v
[root@docker-slave-79101 ~]# cd Postgres-10.12.1v-20200803/
[root@docker-slave-79101 Postgres-10.12.1v-20200803]# sh install.sh 
输入程序安装路径:
        eg: /opt/postgres
        /opt/pgsql
/opt/pgsql
输入数据存放路径:
        eg: /data/12
        /PG/10
/PG/10
postgres 用户不存在,现在增加

 ====================================================
 =               安装成功 !!!                 =
 ====================================================
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en\_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /PG/10 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... PRC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /PG/10 -l logfile start
 ====================================================== 
su - postgres
启动
       pg_ctl -D /PG/10 start
       
[root@docker-slave-79101 Postgres-10.12.1v-20200803]# su - postgres
Last login: Mon Aug  3 14:39:33 CST 2020 on pts/2
[postgres@docker-slave-79101 ~]$ pg_ctl -D /PG/10 start
[postgres@docker-slave-79101 ~]$ pg_ctl -D /PG/10 status
pg_ctl: server is running (PID: 25359)
/opt/pgsql/bin/postgres "-D" "/PG/10"
[postgres@docker-slave-79101 10]$ psql
psql (10.13)
Type "help" for help.

postgres=# create user believer superuser password 'believer'; 
CREATE ROLE
postgres=# \q
[postgres@docker-slave-79101 10]$ vim postgresql.conf 
[root@docker-slave-79101 Postgres-10.12.1v-20200803]# 
主节点修改配置:
#vim postgresql.conf
listen_addresses = '\*'
max_connections = 1000
#shared\_buffer = 512MB
wal_level = hot_standby
synchronous_commit = on
checkpoint_timeout = 5min
archive_mode = on
archive_command = 'test ! -f /PG/10/archivedir/%f && cp %p /PG/10/archivedir/%f'
max_wal_senders = 10
wal_keep_segments = 16
hot_standby = on
max_standby_archive_delay = 30s
max_standby_streaming_delay = 30s
wal_receiver_status_interval = 1s
hot_standby_feedback = on

[postgres@docker-slave-79101 10]$ vim pg_hba.conf 
#vim pg\_hba.conf
#修改成:

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
#host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                    trust
host     replication    believer          192.168.79.0/24       md5
host    replication     all               127.0.0.1/32          trust
host    replication     believer          192.168.79.0/24       trust
#host replication all ::1/128 trust

[postgres@docker-slave-79101 10]$ mkdir -p /PG/10/archivedir/
[postgres@docker-slave-79101 10]$ pg_ctl -D /PG/10 restart

从节点

[root@docker-slave-79102 Postgres-10.12.1v-20200803]# sh install.sh
[root@docker-slave-79102 Postgres-10.12.1v-20200803]# cd /PG
[root@docker-slave-79102 PG]# ll
total 4


为了做好运维面试路上的助攻手,特整理了上百道 **【运维技术栈面试题集锦】** ,让你面试不慌心不跳,高薪offer怀里抱!

这次整理的面试题,**小到shell、MySQL,大到K8s等云原生技术栈,不仅适合运维新人入行面试需要,还适用于想提升进阶跳槽加薪的运维朋友。**

![](https://img-blog.csdnimg.cn/img_convert/ef864ed5637125ea54b520e30ad6294f.png)

本份面试集锦涵盖了

*   **174 道运维工程师面试题**
*   **128道k8s面试题**
*   **108道shell脚本面试题**
*   **200道Linux面试题**
*   **51道docker面试题**
*   **35道Jenkis面试题**
*   **78道MongoDB面试题**
*   **17道ansible面试题**
*   **60道dubbo面试题**
*   **53道kafka面试**
*   **18道mysql面试题**
*   **40道nginx面试题**
*   **77道redis面试题**
*   **28道zookeeper**

**总计 1000+ 道面试题, 内容 又全含金量又高**

*   **174道运维工程师面试题**

> 1、什么是运维?

> 2、在工作中,运维人员经常需要跟运营人员打交道,请问运营人员是做什么工作的?

> 3、现在给你三百台服务器,你怎么对他们进行管理?

> 4、简述raid0 raid1raid5二种工作模式的工作原理及特点

> 5、LVS、Nginx、HAproxy有什么区别?工作中你怎么选择?

> 6、Squid、Varinsh和Nginx有什么区别,工作中你怎么选择?

> 7、Tomcat和Resin有什么区别,工作中你怎么选择?

> 8、什么是中间件?什么是jdk?

> 9、讲述一下Tomcat8005、8009、8080三个端口的含义?

> 10、什么叫CDN?

> 11、什么叫网站灰度发布?

> 12、简述DNS进行域名解析的过程?

> 13、RabbitMQ是什么东西?

> 14、讲一下Keepalived的工作原理?

> 15、讲述一下LVS三种模式的工作过程?

> 16、mysql的innodb如何定位锁问题,mysql如何减少主从复制延迟?

> 17、如何重置mysql root密码?

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化的资料的朋友,可以点击这里获取!](https://bbs.csdn.net/topics/618542503)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化的资料的朋友,可以点击这里获取!](https://bbs.csdn.net/topics/618542503)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值