1 postgresql安装1.1 安装postgresql仓库yum -y install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm1.2 安装客户端软件包yum -y install postgresql951.3 安装服务端软件包y
原创 2018-09-23 18:42:52
10000+阅读
1 备份原理postgresql在数据目录下的pg_xlog子目录中维护了一个WAL日志文件,该文件用于记录数据库文件的每次改变,这种日志文件机制提供了一种数据库热备份的方案,即:在把数据库使用文件系统的方式备份出来的同时也把相应的WAL日志进行备份,即使备份出来的数据块不一致,也可以重放WAL日志把备份的内容推到一致状态。这也就是基于时间点的备份(Point-in-Time Recovery),
原创 2018-09-23 18:35:53
10000+阅读
安装postgres12的Dockerfil[root@mapabcpostgres]#catDockerfile#---------GenericstuffallourDockerfilesshouldstartwithsowegetcaching------------ARGIMAGE_VERSION=buster#FROMarm64v8/debian:$IMAGE_VERSIONFROMar
原创 2021-04-20 15:18:18
2637阅读
从Postgres95到PostgreSQL9.5:新版亮眼特性编者按:高可用架构分享及传播在架构领域具有典型意义的文章,本文由萧少聪分享。转载请注明来自高可用架构公众号「ArchNotes」。萧少聪(花名:铁庵),广东中山人,阿里云RDSforPostgreSQL/PPAS云数据库产品经理。2011年开始与李元佳等组建Postgres中国用户会,现任用户会主席。自2007年起支持中国Postgr
原创 2020-11-09 09:34:45
881阅读
前提:1、请确定postgresql可以访问(远程),postgres用户密码是否修改,否则pgpool无法验证通过2、安装必要的安装包,pgxs,pcp,apt-get install postgresql-server-dev-9.5,否则会报pgxs的错误参考:中文(还好蛮新):http://pgpool.projects.pgfoundry.org/pgpool-II/doc/pgpool
原创 2016-03-15 11:27:51
1934阅读
来源于:://francs3.blog.163.com/blog/static/405767272015711115245190/9.5 版本新增 pg_file_settings 视图,可谓参数设置的神器,为啥这么说呢? 因为 postgresql.conf 参数值调整后,有些 reload 后就生效了,有些需要重启服务才生效,如果你设置的参数值是非法的, pg_ctl reload 命...
initdb名称:初始化一个PostgreSQL数据库簇语法:    initdb [OPTION] [DATADIR]选项:    -A,--auth=METHOD:指定本地连接的认证方法    [-D,--pgdata=]DATADIR:指定数据库簇的原始目录(必须为空)   &nbs
原创 2011-12-15 17:43:20
10000+阅读
继续:下面的是定义信号处理函数。 /* * now we are starting to do real work, trap signals so we can clean up */ /* some of these are not valid on Windows */#ifdef SIGHUP pqsignal(SIGHUP, trapsig);#endif#ifdef SIGINT pqsignal(SIGINT, trapsig);#endif#ifdef SIGQUIT pqsignal(SIGQUIT, trapsig);#endi...
转载 2013-07-08 08:07:00
65阅读
2评论
继续分析: setup_dictionary();展开:其中:cmd 是:"/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true -j template1 >/dev/nulldictionary_file 是:/home/pgsql/project/share/snowball_create.sql/* * load extra dictionaries (Snowball stemmers) */static voidsetu
转载 2013-07-09 09:36:00
57阅读
2评论
继续分析: if (pwprompt || pwfilename) get_set_pwd();由于我启动initdb的时候,没有设置口令相关的选项,故此略过。接下来: setup_depend();展开:就是一组sql问,送给 postgres 执行:cmd的值是:"/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true template1 >/dev/null/* * set up pg_depend */static void
转载 2013-07-08 17:01:00
58阅读
2评论
继续分析: /* Bootstrap template1 */ bootstrap_template1();展开:我这里读入的文件是:/home/pgsql/project/share/postgres.bki/* * run the BKI script in bootstrap mode to create template1 */static voidbootstrap_template1(void){ PG_CMD_DECL; char **line; char *talkargs = ""; char **bki_l...
转载 2013-07-08 15:44:00
116阅读
2评论
继续分析: /* Top level PG_VERSION is checked by bootstrapper, so make it first */ write_version_file(NULL);就是建立了一个 PG_VERSION的文件在我系统里,可以看到:[pgsql@localhost DemoDir]$ cat PG_VERSION9.1[pgsql@localhost DemoDir]$ 接下来:我先看看 set_null_conf 函数 /* Select suitable configuration settings */ set_null_co...
转载 2013-07-08 13:29:00
288阅读
2评论
继续分析 /* Now create all the text config files */ setup_config();将其展开:实质就是,确定各种参数,分别写入 postgresql.conf 、pg_hba.conf、pg_indent.conf 文件。/* * set up all the config files */static voidsetup_config(void){ char **conflines; char repltok[100]; char path[MAXPGPATH]; fputs(...
转载 2013-07-08 13:45:00
59阅读
2评论
继续分析,如下这段,因为条件不成立,被跳过: /* Create transaction log symlink, if required */ if (strcmp(xlog_dir, "") != 0) { fprintf(stderr,"In main function -----------------190\n"); char *linkloc; /* clean up xlog directory name, check it's absolute */ canonicalize_path(xlo...
转载 2013-07-08 09:16:00
66阅读
2评论
继续分析: if (pwprompt && pwfilename) { fprintf(stderr, _("%s: password prompt and password file cannot be specified together\n"), progname); exit(1); } if (authmethod == NULL || !strlen(authmethod)) { authwarning = _("\nWARNING: enabling \"trust\" authentication for ...
转载 2013-07-05 16:55:00
72阅读
2评论
接前面,继续分析:putenv("TZ=GMT") 设置了时区信息。find_other_exec(argv[0], "postgres", PG_BACKEND_VERSIONSTR, backend_exec))就是要找到同目录下、同版本的postgres备用。initdb 执行后期,很多事情要依赖 postgres来处理的。 /* * Also ensure that TZ is set, so that we don't waste time identifying the * system timezone each of the ma
转载 2013-07-05 17:07:00
59阅读
2评论
继续分析下面的是获取运行此程序的用户名称,主要还是为了防止在linux下用root来运行的情形。 effective_user = get_id(); if (strlen(username) == 0) username = effective_user;接下来,是准备好一写预备生成的文件的名称变量: set_input(&bki_file, "postgres.bki"); set_input(&desc_file, "postgres.description"); set_input(&shdesc_file, "
转载 2013-07-05 17:33:00
67阅读
2评论
继续分析下面这一段,当 initdb --version 或者 initdb --help 才有意义。 if (argc > 1) { if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0) { usage(progname); exit(0); } if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0) { ...
转载 2013-07-05 15:51:00
49阅读
2评论
继续分析 setup_description();展开后:就是要把share/postgres.description 文件的内容读入到 pg_description 和 pg_shdescription/* * load description data */static voidsetup_description(void){ PG_CMD_DECL; fputs(_("loading system objects' descriptions ... "), stdout); fflush(stdout); snprintf(cmd, sizeof(cmd),.
转载 2013-07-09 08:42:00
65阅读
2评论
继续分析: setup_collation()展开:/* * populate pg_collation */static voidsetup_collation(void){#if defined(HAVE_LOCALE_T) && !defined(WIN32) int i; FILE *locale_a_handle; char localebuf[NAMEDATALEN]; int count = 0; PG_CMD_DECL;#endif fputs(_("creating...
转载 2013-07-09 08:54:00
73阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5