页面“Mysql故障”与“Postgresql”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
 +
=优点=
 +
 +
ython中的web开发框架Django也是推荐与PostgreSQL配合使用的。
 +
说PostgreSQL性能差的,可以看:一个简单PGSQL调优的例子 性能可以达到30万QPS,随机更新的测试可以达到10万tps
 +
 +
=options=
 +
 +
版本9.6.6
 +
 +
要备份脚本  和常用 命令 ,并要上线让老谢用一下下
 +
 +
=备份=
 
<pre>
 
<pre>
 +
##2.逻辑备份源实例数据
 +
 +
通过 PostgreSQL 客户端,连接本地(源) PostgreSQL 数据库。
 +
 +
执行如下命令,备份数据。
 +
 +
pg_dump -U username -h hostname -p port databasename -f filename
 +
参数说明如下:
 +
 +
username:本地数据库用户名
 +
hostname:本地数据库主机名,如果是在本地数据库主机登录,可以使用 localhost
 +
port:本地数据库端口号
 +
databasename:要备份的本地数据库名
 +
filename:要生成的备份文件名称
 +
例如,数据库用户 pgtest 要备份本地 PostgreSQL 数据库,登录 PostgreSQL 主机后,通过如下命令备份数据。
 +
 +
pg_dump -U pgtest -h localhost -p 4321= pg001 -f pg001.sql </pre>
 +
 +
[https://cloud.tencent.com/document/product/409/7552 数据导入至PostgreSQL实例]
 +
 +
=监控=
 +
[https://wiki.postgresql.org/wiki/Monitoring#Zabbix  postgresql Monitoring]
 +
 +
http://pg-monz.github.io/pg_monz/index-en.html
 +
 +
[https://wiki.postgresql.org/wiki/YUM_Installation#Install_PostgreSQL YUM Installation]
  
log_bin_trust_function_creators错误解决
 
  
+
[https://wiki.postgresql.org/wiki/9.1%E7%AC%AC%E5%8D%81%E4%BA%94%E7%AB%A0 第十五章 从源码安装]
  
当有mysql本地或远程建立function或procedure时报上面的错误
+
=postgresql 主从=
 +
[http://blog.csdn.net/wlwlwlwl015/article/details/53287855 PostgreSQL 9.5.5主从实现之异步流复制(Hot Standby)]
  
或者如果开启了二进制日志,但是用户没有supper 权限;那么他在创建trigger 时会提示设置log_bin_trust_function_creators=1
+
[https://yq.aliyun.com/articles/46629# postgres配置主从流复制]
  
经试验是log_bin_trust_function_creators值为off导致
+
[http://www.cnblogs.com/yjf512/p/4499547.html postgres配置主从流复制]
  
设置:
+
=postgresql集群=
  
set global log_bin_trust_function_creators=1;
+
以前PostgreSQL本身没有集群功能,但是有开源的第三方解决方案,比较成熟的有Postgres XC(PGXC)和Postgres XL(PGXL)。PGXC跟进PostgreSQl的版本相对比较快,PGXL的功能比较强大一些,主要多了MPP (Massively Parallel Processing) Parallelism。PGXC集群的架构主要分全局事务管理器、协调器和数据节点三个部分,通过全局事务管理器(GTM ,Global Transaction Manager)作为单点来控制多个协调器(Coordinator),由协调器来解析SQL并把SQL分到多个数据节点(Data Node)上,取回数据后合并数据集,返回给调用者。
  
但重启后失效
+
https://www.postgresql.org/docs/9.6/static/high-availability.html
  
永久解决方案
+
[http://valleylord.github.io/post/201409-postgres-cluster/ PostgreSQL集群搭建(使用Postgres XC)]
  
windows下my.ini[mysqld]加上log_bin_trust_function_creators=1
+
https://wiki.postgresql.org/wiki/9.1%E7%AC%AC%E5%8D%81%E4%B8%83%E7%AB%A0
linux下/etc/my.cnf下my.ini[mysqld]加上log_bin_trust_function_creators=1
 
  
 +
[https://my.oschina.net/mye/blog/380604 用Pgpool-II实现Postgresql高可用集群]
  
</pre>
+
[https://segmentfault.com/a/1190000007012082 PG的两种集群技术:Pgpool-II与Postgres-XL]
  
  
=see also=
+
=连接tools=
 +
[https://www.pgadmin.org/download/ pgadmin]
  
 +
=参考=
  
[https://www.cnblogs.com/flying607/p/5576584.html log_bin_trust_function_creators变量解释]
+
[https://blog.csdn.net/TADICAN/article/details/7530616 现有PostgreSQL 集群/热备方案]
  
  
[http://www.saunix.cn/617.html mysql磁盘IO问题]
 
  
[https://www.jianshu.com/p/120af2e25454 一次mysql排错]
+
[http://kedgeree.me/posts/postgre-encoding.html postgres编码设置]
  
[https://blog.csdn.net/mydriverc2/article/details/38304355 谨慎设置binlog_format=MIXED]
 
  
 +
[https://www.lvtao.net/study_doc/postgresql/index.html PostgreSQL教程]
  
 +
[http://www.cnblogs.com/ae6623/p/6149375.html PostgreSQL入门教程]
  
 +
[http://askcuix.github.io/blog/2014/01/24/the-command-of-postgresql/ Postgresql常用命令]
  
[[category:mysql]]
+
[[category:postgresql]]

2019年10月21日 (一) 06:33的版本

优点

ython中的web开发框架Django也是推荐与PostgreSQL配合使用的。 说PostgreSQL性能差的,可以看:一个简单PGSQL调优的例子 性能可以达到30万QPS,随机更新的测试可以达到10万tps

options

版本9.6.6

要备份脚本 和常用 命令 ,并要上线让老谢用一下下

备份

##2.逻辑备份源实例数据

通过 PostgreSQL 客户端,连接本地(源) PostgreSQL 数据库。

执行如下命令,备份数据。

 pg_dump -U username -h hostname -p port databasename -f filename
参数说明如下:

username:本地数据库用户名
hostname:本地数据库主机名,如果是在本地数据库主机登录,可以使用 localhost
port:本地数据库端口号
databasename:要备份的本地数据库名
filename:要生成的备份文件名称
例如,数据库用户 pgtest 要备份本地 PostgreSQL 数据库,登录 PostgreSQL 主机后,通过如下命令备份数据。

 pg_dump -U pgtest -h localhost -p 4321= pg001 -f pg001.sql 

数据导入至PostgreSQL实例

监控

postgresql Monitoring

http://pg-monz.github.io/pg_monz/index-en.html

YUM Installation


第十五章 从源码安装

postgresql 主从

PostgreSQL 9.5.5主从实现之异步流复制(Hot Standby)

postgres配置主从流复制

postgres配置主从流复制

postgresql集群

以前PostgreSQL本身没有集群功能,但是有开源的第三方解决方案,比较成熟的有Postgres XC(PGXC)和Postgres XL(PGXL)。PGXC跟进PostgreSQl的版本相对比较快,PGXL的功能比较强大一些,主要多了MPP (Massively Parallel Processing) Parallelism。PGXC集群的架构主要分全局事务管理器、协调器和数据节点三个部分,通过全局事务管理器(GTM ,Global Transaction Manager)作为单点来控制多个协调器(Coordinator),由协调器来解析SQL并把SQL分到多个数据节点(Data Node)上,取回数据后合并数据集,返回给调用者。

https://www.postgresql.org/docs/9.6/static/high-availability.html

PostgreSQL集群搭建(使用Postgres XC)

https://wiki.postgresql.org/wiki/9.1%E7%AC%AC%E5%8D%81%E4%B8%83%E7%AB%A0

用Pgpool-II实现Postgresql高可用集群

PG的两种集群技术:Pgpool-II与Postgres-XL


连接tools

pgadmin

参考

现有PostgreSQL 集群/热备方案


postgres编码设置


PostgreSQL教程

PostgreSQL入门教程

Postgresql常用命令