注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

PostgreSQL 中文网

 
 
 

日志

 
 

PostgreSQL:测试 readline 和 zlib 选项  

2013-11-18 17:12:28|  分类: Postgres基础 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |


        PostgreSQL 编译安装时默认支持 readline 和 zlib,其中 readline 选项支持 psql 历史命令查看
等功能,zlib 选项支持 pg_dump 的压缩功能,下面测试这两个功能,测试方法:重新编译 PostgreSQL 
并不带readline 和 zlib 选项:
 
一 重新编译安装
--创建用户
 #groupadd pgtest
#useradd -g pgtest pgtest
#passwd pgtest
   

--环境变量 .bash_profile
 export PGPORT=1922
export PGUSER=postgres
export PGDATA=/database/pgtest/pgdata/pg_root
export LANG=en_US.utf8

export PGHOME=/opt/pgsql_test
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
export DATE=`date +"%Y%m%d%H%M"`
export PATH=$PGHOME/bin:$PATH:.
export MANPATH=$PGHOME/share/man:$MANPATH
alias rm='rm -i'
alias ll='ls -lh'
 

--清理编译文件,重新编译
 # gmake clean
# gmake distclean
 
--编译
 ./configure --prefix=/opt/pgsql_test --with-pgport=1922 --with-wal-blocksize=16 --without-readline --without-zlib 
 备注:注意选项 --without-readline --without-zlib 

--安装
 # gmake world
# gmake install-world
 
--初始化 initdb
 $ initdb -D /database/pgtest/pgdata/pg_root  -E UTF8 --locale=C -U postgres -W
 备注:以数据库用户执行 initdb 操作即可,这里是以 pgtest 用户执行。

二 测试
--2.1 readline 测试
--2.1.1 上下翻键无效,Backspace 键也无效
 [pgtest@host172-16-3-215 ~]$ psql
psql (9.1.9)
Type "help" for help.

postgres=# select now();
              now              
-------------------------------
 2013-11-18 13:56:55.350743+08
(1 row)

postgres=# ^[[A  ----上下翻键无效
 备注:如果没安装Readline 库,既编译时加上 --without-readline 选项,那么 psql 端不能使用上下
              翻键和 Backspace 键,也不能查看历史 psql 命令,非常不方便。
       
--2.2 zlib 测试
--2.2.1 建库
 [pgtest@host172-16-3-215 ~]$ psql
psql (9.1.9)
Type "help" for help.

postgres=# create database francs;
CREATE DATABASE
 
--2.2.2 建表
 francs=# create table test_1 (id int4);
CREATE TABLE

francs=# insert into test_1 select generate_series(1,1000);
INSERT 0 1000
 
--2.2.3 备份测试
 [pgtest@host ~]$ pg_dump -h 127.0.0.1 -E UTF8 -Fc francs -v > francs.dmp
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading extensions
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading table inheritance information
pg_dump: reading rewrite rules
pg_dump: finding extension members
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: finding the columns and types of table "test_1"
pg_dump: flagging inherited columns in subtables
pg_dump: reading indexes
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading large objects
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving standard_conforming_strings = on
pg_dump: saving database definition
pg_dump: [archiver] WARNING: requested compression not available in this installation -- archive will be uncompressed
pg_dump: dumping contents of table test_1
 备注:查看日志输出倒数第二行,"pg_dump: [archiver] WARNING: requested compression not available 
            in this  installation " , 表示不支持压缩,而这个功能是备份数据库时压缩比高,非常有用。


三 总结
   Readline 和 zlib 属性非常重要,在编译 PostgreSQL 时,强烈推荐启用。
   

四 附
--4.1 Readline 解释
    The GNU Readline library is used by default. It allows psql (the PostgreSQL command line SQL interpreter) to remember each command you type, and allows you to use arrow keys to recall and edit previous commands. This is very helpful and is strongly recommended. If you do not want to use it then you must specify the --without-readline option to configure. As an alternative, you can often use the BSD-licensed libedit library, originally developed on NetBSD. The libedit library is GNU Readline-compatible and is used if libreadline is not found, or if --with-libedit-preferred is used as an option to configure. If you are using a package-based Linux distribution, be aware that you need both the readline and readline-devel packages, if those are separate in your distribution.

--4.2 zlib  解释
    The zlib compression library is used by default. If you do not want to use it then you must specify the --without-zlib option to configure. Using this option disables support for compressed archives in pg_dump and pg_restore.

五 参考

  评论这张
 
阅读(1107)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016