postgresql 9.3.1 编译安装1 编译、安装tar -xvf postgresql-9.3.1.tar cd postgresql-9.3.1./configure --prefix=/opt/soft/postgresql-9.3.1/ --with-perl --with-python --with-blocksize=32 --with-wal-blocksize=32 --with-wal-segsize=64makemake install 2 创建用户及组groupadd postgresuseradd -g postgres postgrespasswd postgres3 环境设置 mkdir /usr/local/pgsql/data chown postgres:postgres -R /usr/local/pgsql/ su - postgres vi .bash_profile 添加:export PGHOME=/usr/local/pgsqlexport PGDATA=$PGHOME/dataexport PATH=$PATH:$HOME/bin:$PGHOME/bin $source .bash_profile 4 初始化数据库 $initdb -D $PGDATA5 启动postgres数据库pg_ctl -D /usr/local/pgsql/data start 6 系统服务配置及开机自动启动cd /opt/soft/postgresql-9.3.1/contrib/start-scripts cp linux /etc/init.d/postgresql #chmod u+x /etc/init.d/postgresql #service postgresql status--(start | stop)7 修改postgres数据库为归档模式vi postgresql.confwal_level = archive# - Archiving -archive_mode = on # allows archiving to be done # (change requires restart)archive_command = 'cp %p /usr/local/pgsql/archive/%f' # command to use to archive a logfile segment # placeholders: %p = path of file to archive # %f = file name only # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'#archive_timeout = 0 # force a logfile segment switch after this # number of seconds; 0 disables# - Archiving -archive_mode = on # allows archiving to be done # (change requires restart)archive_command = 'cp %p /usr/local/pgsql/archive/%f' # command to use to archive a logfile segment # placeholders: %p = path of file to archive # %f = file name only # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'#archive_timeout = 0 # force a logfile segment switch after this # number of seconds; 0 disables##切换归档select pg_switch_xlog();这个时候我们到归档日志的目录下去查看有没有归档日志生成[09:39:25 postgres()@kiwi archive]$ ls000000010000000000000001其中archive_command中%p会自动识别为WAL目录,你不用管,%f你也不用管。这个archive_command在什么时候执行呢,即Postgresql在每次WAL日志16MB段满的时候才执行,即把其拷贝到/home/postgres/archive中. 总结
以上是内存溢出为你收集整理的postgresql 9.3.1 编译安装全部内容,希望文章能够帮你解决postgresql 9.3.1 编译安装所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)