当前位置: 首页 > news >正文

济南网站的建设企业网站推广的方法有( )

济南网站的建设,企业网站推广的方法有( ),深圳网站建设行业新闻,wordpress 外链转内链 页面实验目的 配置一个最简的主从环境,了解基本的主从配置。 环境参数 操作系统CentOS Linux release 7.9.2009 (Core)数据库版本PostgreSQL 10.23主库端口15431备库端口15432 因为只是做实验,所以主备库放在同一台机器上,仅通过端口区分主备…

实验目的

配置一个最简的主从环境,了解基本的主从配置。

环境参数

操作系统CentOS Linux release 7.9.2009 (Core)
数据库版本PostgreSQL 10.23
主库端口15431
备库端口15432
  • 因为只是做实验,所以主备库放在同一台机器上,仅通过端口区分主备
  • 操作的系统用户为pg,没有特殊说明的情况下操作命令都由pg用户执行

搭个环境

初始化主库

[pg@localhost ~]$ pg_ctl -D /data/db1 init
The files belonging to this database system will be owned by user "pg".
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.creating directory /data/db1 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Shanghai
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... okWARNING: 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:/usr/pgsql-10/bin/pg_ctl -D /data/db1 -l logfile start

配置主库参数

[pg@localhost ~]$ vi /data/db1/postgresql.conf
修改如下参数:
---------------------------------------
port = 15431	#主库端口
unix_socket_directories = '/tmp'  #本地连接socket文件目录pg访问/var/run/postgresql会有权限制问题,反正不打算用本地socket方式连接所以直接改成/tmp
[pg@localhost ~]$ vi /data/db1/pg_hba.conf
确认已开启本地复制的权限,本地连接的所有用户都有备机的复制权限
---------------------------------------
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

初始化备库

备库的基准文件必须来自于主库,直接复制主库文件到备库位置即可。

[pg@localhost ~]$ rsync -avz /data/db1/* /data/db2#修改主备库目录的权限为0700,否则会导致数据库启动异常
[pg@localhost ~]$ chmod 0700 /data/db[1,2]

配置备库参数

备库需求配置一个特定的参数文件recovery.conf,可以从安装目录中复制文件模板过来修改。

[pg@localhost ~]$ cp /usr/pgsql-10/share/recovery.conf.sample /data/db2/recovery.conf[pg@localhost ~]$ vi /data/db2/recovery.conf
开启备库模式
---------------------------------------
standby_mode = on
[pg@localhost ~]$ vi /data/db2/postgresql.conf
修改如下参数:
---------------------------------------
port = 15432
unix_socket_directories = '/tmp'

验证主备功能

#启动主库
[pg@localhost ~]$ pg_ctl -D /data/db1/ -l /data/db1/server.log start
waiting for server to start.... done
server started#启动备库
[pg@localhost ~]$ pg_ctl -D /data/db2/ -l /data/db2/server.log start
waiting for server to start.... done
server started#查看可用账号和库
[pg@localhost ~]$ psql -l -h localhost -p 15431List of databasesName    | Owner | Encoding |   Collate   |    Ctype    | Access privileges
-----------+-------+----------+-------------+-------------+-------------------postgres  | pg    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |template0 | pg    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/pg            +|       |          |             |             | pg=CTc/pgtemplate1 | pg    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/pg            +|       |          |             |             | pg=CTc/pg
(3 rows)[pg@localhost ~]$ psql -l -h localhost -p 15432List of databasesName    | Owner | Encoding |   Collate   |    Ctype    | Access privileges
-----------+-------+----------+-------------+-------------+-------------------postgres  | pg    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |template0 | pg    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/pg            +|       |          |             |             | pg=CTc/pgtemplate1 | pg    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/pg            +|       |          |             |             | pg=CTc/pg
(3 rows)#连接主库,建表
[pg@localhost ~]$ psql -h localhost -p 15431 -U pg postgres
psql (10.23)
Type "help" for help.postgres=# create table t3(a int);
CREATE TABLE
postgres=# insert into t3(a) values (1),(2),(3);
INSERT 0 3#连接备库查看看同步情况
[pg@localhost ~]$ psql -h localhost -p 15432 -U pg postgres
psql (10.23)
Type "help" for help.postgres=# \dtList of relationsSchema | Name | Type  | Owner
--------+------+-------+-------public | t3   | table | pg
(1 row)postgres=# select * from t3;a
---123
(3 rows)postgres=#
http://www.yayakq.cn/news/31046/

相关文章:

  • 网站关键词排名怎么提升成都做小程序哪个服务最好
  • 有关网站建设国内外现状的文献展厅公司
  • 福州公司网站建设一定要用主流程序php语言网站建设地图怎么设置
  • 网站区域名怎么注册可信网站网站认证
  • 广州做网站的价格如何把图片放到网站后台
  • WordPress第三方注册昆明网站seo外包
  • 河南省建设厅村镇建设处网站wordpress 淘宝客页面
  • 校园二手交易网站开发专门做酒的网站有哪些
  • 色彩网站设计师wordpress编辑器替换
  • 温州网站建设优化公司能够沟通业务的网站
  • 南京建设网站广西壮族自治区官网
  • 网站建设功能文档seo技术建站
  • 网站的后端用什么软件做网站开发的经费预算
  • 珠海网站艰涩和网站开发与设计入门
  • 哈尔滨网站建设网站开发网站建设工厂
  • 龙华app网站开发公司做网站提供资料
  • 前端电商网站开发周期网站建设 数据归属
  • linux网站如何做ip解析app模拟制作
  • 网站建设定制开发价格免费python在线网站
  • 网站设计需要的元素wordpress默认的编辑器
  • 播放器网站怎么做青岛网站推广的价格
  • 怎么做网站设蒙icp备 网站建设
  • 网站建设数据库配置做网站用的服务器
  • 极简风格网站介绍大庆市城乡建设局网站首页
  • 企业网站建设排名网址网页设计教程ui
  • 做网站销售水果docker wordpress多个
  • wh网站建设seo应用领域
  • 并提示网站菜单导航及用户登录传奇广告网站怎么做
  • 网站被挟持怎么办Saas和wordpress有什么区别
  • 网站流程优化机械加工网上怎么接单