


版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、流的安装、配置与切上传至/usr/local/src下yumyuminstall-yreadline-devel.x86_64 yum install -y zlib-devel.x86_64-8*/usr/sbin/ntpdate vi /etc/sysctl.conf kernel.shmmni=4096kernel.sem=501006412800050100fs.file-max= net.core.rmem_max=net.core.wmem_default=net.core.wmem_max= mit_memory= fs.aio-max-nr= 将参数加载到内核,执行sysctl
2、配置limits.confvi softnofile hardnofilesoftnprochardnprocsoftcore hardcore softmemlock hardmemlock 关闭vi/etc/sysconfig/selinux 状态:chkconfiglist|grepi关闭:# /sbin/chkconfig iptables rootlocalhost# groupadd postgres rootlocalhost#useradd-gpostgrespostgres rootlocalhost# passwd postgresrootlocalhostsrc#tar-
3、jxvfpostgresql-9.4.2.tar.bz2 rootlocalhost src#cd postgresql-9.4.2postgresql-9.4.2#./configure -prefix=/usr/local/postgresql-9.4.2 -with-rootlocalhost pgsql-9.4.2#make rootlocalhost pgsql-9.4.2#make install rootlocalhost pgsql-9.4.2#cd /usr/local rootlocalhost local#ln-spostgresql-9.4.2pgsqlrootloca
4、lhost local#chown-Rpostgres:postgrespostgresql-9.4.2 rootlocalhost local#chown -R postgres:postgres pgsql设置 Postgres 用户环境变量 rootlocalhostpgsql-9.4.2supostgres postgreslocalhost$morebash_profile postgreslocalhost $ vi .bash_profileexport PATH # .bash_profile#Getthealiasesandfunctions if -f /.bashrc ;
5、 then.#Userspecificenvironmentandstartupprograms export PGPORT=5432export PGDATA=/PGDATA/dataexportexportrootlocalhostmkdir -p /PGDATA/data rootlocalhostmkdir -p /PGDATA/archive_log rootlocalhostchown-Rpostgres:postgres/PGDATA od -R 700 /PGDATArootlocalhostsu 这数据库名填写的是 replication,这并不是表示连接到名称为 repli
6、cation 数据库上,而是表示准replication 编辑 的安postgreslocalhostdata$postgres localhost data$ mkdir pg_log postgres localhost data$od700pg_log postgres localhost data$ ls -lthrtotal2postgrespostgres4.0KJul2909:442postgres postgres4.0KJul2909:442postgrespostgres4.0KJul2909:442postgrespostgres4.0KJul2909:442postgr
7、espostgres4.0KJul2909:442postgres postgres4.0KJul2909:442postgrespostgres4.0KJul2909:442postgrespostgres4.0KJul2909:444postgrespostgres4.0KJul2909:44-rw- 1 postgres postgres4Jul2909:44PG_VERSION 4 postgres postgres 4.0K Jul 29 09:44 pg_logical-rw-1postgres88Jul2909:44-1 postgrespostgres1.6KJul2909:4
8、4-1 postgrespostgres4.4KJul2909:443postgrespostgres4.0KJul2909:442postgrespostgres4.0KJul2909:442postgrespostgres4.0KJul2909:442postgrespostgres4.0KJul2909:442postgrespostgres4.0KJul2909:445postgrespostgres4.0KJul2909:44-rw-1postgrespostgres 21KJul2910:01postgresql.conf 2 postgres postgres 4.0K Jul
9、29 10:01 pg_logpostgreslocalhost $pg_ctlstart server startingcreaterolereploginreplicationencryptedpasswordrep; select 如postgres localhost $ vi.pgpass postgres localhost $od600.pgpasspostgres localhost $ cat .pgpass postgres localhost $od600.pgpassrootlocalhostsupostgreslocalhost$pg_basebackup-h192.
10、168.236.120-p5432-Urep-Fp-P -x-R-D$PGDATA -lrepbackup20150729 37466/37466 kB (100%), 1/1 tablespacepostgreslocalhost $cd/PGDATA/data postgres localhost $vi recovery.conf standby_mode = onprimary_conninfo=user=reppassword=rephost=192.168.179.109port=5432 mand = cp /PGDATA/archive_log/%f %ptrigger_fil
11、e=recovery_timeline= postgreslocalhost pg_xlog$scp00*postgreslocalhost pgdata$ls-l total 120-rw-1postgres198Jul2911:48drwx-5postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48-rw-1postgrespostgres 4678Jul2911:
12、52-rw-1postgrespostgres 1636Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-4postgrespostgres 4096Jul2911:48drwx-4postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drw
13、x-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48drwx-2postgrespostgres 4096Jul2911:48-rw-1postgres4Jul2911:48drwx-3postgrespostgres 4096Jul2911:48-rw-1postgres88Jul2911:481postgrespostgres21267Jul2911:48
14、-rw-rw-r- 1 postgres postgres227Jul2911:51recovery.conf postgres localhost $ pg_ctl startserverpostgreslocalhost archive$top-c-u29518postgres 20 0 266m22161532S 0.0 0.1 0:00.00postgres: walsenderprocess rep192.168.179.228(17596) streaming0/6000500postgreslocalhost $top-c-u5489postgres 20 0 266m16281
15、120S 0.0 0.0 0:00.03postgres:startup5498postgres 20 0 270m17881296S 0.0 0.0 0:00.08postgres:wal receiverprocess streamingpostgres localhost $ pg_controldata pg_control version number:CatalogversionDatabase cluster state:inpostgreslocalhost $pg_controlversionCatalogversionDatabasesystemDatabasecluste
16、rinarchive5postgreslocalhostpg_xlog$psqlpostgres psql (9.4.2)Typehelpforhelp. postgres=#createtablexing(idint,namevarchar(20); postgres=# insert into xing values(1,guang);postgres=#select*fromxing; id | name+1 |(1 postgresdroptablexing; DROP TABLEpostgres=# No relations 开机自启动 rootlocalhoststart-scri
17、pts#cp/usr/local/src/postgresql-9.4.2/contrib/start- scripts/linux /etc/init.d/postgresqlrootlocalhost start-scripts# cd /etc/init.d/ rootlocalhostinit.d#ls-l|grep-ipostgresql-rw-r-r- 1rootroot 3437Jul2909:45postgresql rootlocalhost init.d#od +x postgresql rootlocalhost init.d# vi postgresql prefix=
18、/usr/local/pgsql -postgresql装路PGDATA=/PGDATA/data -postgresql 的数据 流主备切postgreslocalhost pg_xlog$ pg_ctl stop -m fast waiting for server to shut down.server postgreslocalhost pg_xlog$scp00*注作为初次切换需要copy 日志文件,当主节点ps ef|grep postgres 时看不到postgreslocalhostdata$pg_ctlpromote server promoting注:会使recovery.
19、confpostgreslocalhostpg_xlog$ps-ef|greppostgres3072830656 015:1500:00:00postgres:archiverprocess lastwasstandby_mode= primary_conninfo=user=reppassword=rephost=192.168.236.228port=5432 mand = cp /PGDATA/archive_log/%f %ptrigger_file=/PGDATA/trigger_activestandby recovery_timeline = latestpostgresloc
20、alhost$cdpostgreslocalhost pg_xlog$scp.historypostgreslocalhostdata$pg_ctlstart server startingpostgreslocalhostdata$LOG: redirectinglogoutputtologgingcollectorprocess HINT: Future log output will appear in directory /PGDATA/data/pg_log.top cupostgreslocalhostpg_xlog$ps-ef|grep013:1600:00:00su-postg
21、res013:1600:00:00-postgres1015:1100:00:00 /usr/local/postgresql-postgres015:1100:00:00postgres:loggerpostgres015:1100:00:00 postgres: checkpointer postgres015:1100:00:00postgres:writerpostgres015:1100:00:00postgres:statscollectorpostgres015:1500:00:00postgres:walwriterpostgres015:15 postgres015:1500
22、:00:00postgres:archiverprocess lastwaspostgres015:1600:00:00postgres:walsenderprocessrep192.168.179.228(17668)streamingpostgres015:2100:00:00ps-postgres015:2100:00:00greppostgresnfspg_xlog$kill-930656 postgresnfs pg_xlog$postgresnfspg_xlog$ps-ef|grep29207013:1600:00:00su-29208013:1600:00:00-30817015
23、:2200:00:00ps-30818015:2200:00:00greppostgresguangdata$pg_ctlpromote server promotingpostgresguang postgresguangdata$ps-ef|grep013:1600:00:00su-013:1600:00:00-1015:16 015:1600:00:00postgres:logger015:1600:00:00 postgres: checkpointer 015:1600:00:00postgres:writer015:1600:00:00postgres:statscollector015:2400:00:00postgres:walwriter015:24 015:2400:00:00postgres:
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030年中国除草剂市场运营状况发展趋势分析报告
- 2025-2030年中国锆英砂行业供需现状及投资发展规划研究报告
- 2025-2030年中国连接器制造市场发展动态及前景趋势预测报告
- 2025-2030年中国轮滑鞋行业发展现状及前景趋势分析报告
- 2025-2030年中国血浆增容剂行业运行动态与发展风险评估报告
- 2025-2030年中国葵花油市场运行态势及发展盈利分析报告
- 2025-2030年中国艺术玻璃行业市场运行态势及投资战略研究报告
- 2025-2030年中国管道检测行业供需现状及投资发展规划研究报告
- 2025-2030年中国空冷器市场运行现状及发展策略分析报告
- 2025-2030年中国种衣剂市场运营状况及发展趋势研究报告
- 医药行业:创新药产业链研究培训框架-20210807-中信建投-79正式版
- 外部干扰排查流程及案例
- 商业银行信贷实务:第一章 商业银行信贷概述
- 灌注桩钢筋笼自动计算套用表格
- 机械工业建设项目概算编制办法及各项概算指标
- 苏科版七年级数学下册期末复习+10(专题-几何图形的证明)
- 人人都是产品经理2 0:写给泛产品经理
- 振动振动测试基础知识培训课件
- 《云南澜沧铅矿有限公司勐滨煤矿采矿权价款退还计算说明》
- sbl-ep16高低压开关柜培训中法文kyn6140.5安装使用说明书
- GB/T 9113.1-2000平面、突面整体钢制管法兰
评论
0/150
提交评论