Change data directory – PostgreSQL
发布时间:2020-12-13 17:09:16 所属栏目:百科 来源:网络整理
导读:Useful and common task,should be well documented. Let′s try it! Debian 7.4 x64,PostgreSQL 9.3.2 I just checked via psql where is current data directory stored. Default path = /var/lib/postgresql/9.3/main . As a root i will create new direc
Useful and common task,should be well documented. Let′s try it! Debian 7.4 x64,PostgreSQL 9.3.2
I just checked via psql where is current data directory stored. Default path = /var/lib/postgresql/9.3/main . As a root i will create new directory,/PGDATA and assign ownership into postgres user: root@deb74:/var/lib/postgresql/9.3/main# mkdir -p /PGDATA root@deb74:/var/lib/postgresql/9.3/main# chown -R postgres:postgres /PGDATA root@deb74:/var/lib/postgresql/9.3/main# service postgresql stop [ ok ] Stopping PostgreSQL 9.3 database server: main. Last step = pure paranoia level and untrustful ?restart“ service parameter :-) As postgres user I will re-initialize database: postgres@deb74:/usr/lib/postgresql/9.3/bin$ /usr/lib/postgresql/9.3/bin/initdb -D /PGDATA The files belonging to this database system will be owned by user ?postgres“. This user must also own the server process. The database cluster will be initialized with locale ?en_US.UTF-8“. The default database encoding has accordingly been set to ?UTF8“. The default text search configuration will be set to ?english“. Data page checksums are disabled. fixing permissions on existing directory /PGDATA … ok creating subdirectories … ok selecting default max_connections … 100 selecting default shared_buffers … 128MB creating configuration files … ok creating template1 database in /PGDATA/base/1 … ok initializing pg_authid … ok initializing dependencies … ok creating system views … ok loading system objects‘ descriptions … ok creating collations … ok creating conversions … ok creating dictionaries … ok setting privileges on built-in objects … ok creating information schema … ok loading PL/pgSQL server-side language … ok vacuuming database template1 … ok copying template1 to template0 … ok copying template1 to postgres … ok syncing data to disk … ok WARNING: enabling ?trust“ authentication for local connections You can change this by editing pg_hba.conf or using the option -A,or –auth-local and –auth-host,the next time you run initdb. Success. You can now start the database server using: /usr/lib/postgresql/9.3/bin/postgres -D /PGDATA or /usr/lib/postgresql/9.3/bin/pg_ctl -D /PGDATA -l logfile start Change in configuration must be written into main postgresql conf file: postgres@deb74:~$ cd /etc/postgresql/9.3/main/ postgres@deb74:/etc/postgresql/9.3/main$ nano postgresql.conf There you have to change data_directory into '/PGDATA',save file. Now I need just to start postgresql service and double-check if everything is changed well: root@deb74:~# service postgresql start [ ok ] Starting PostgreSQL 9.3 database server: main. root@deb74:~# su postgres postgres@deb74:/root$ psql could not change directory to ?/root“: Permission denied psql (9.3.2) Type ?help“ for help. postgres=# show data_directory; data_directory —————- /PGDATA (1 row) -a-
from:http://it.tuxie.eu/?p=515 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 建物化视图,完成query rewrite,refresh功能
- oracle 配置 ACL 使用数据库发送WebServic请求时需要
- 如何加快flex程序启动时的加载速度
- PostgreSQL判断一个表是否存在
- 电话号码正则表达式(支持手机号码,3-4位区号,7-8位直播号
- CocoStudio导出的LUA文件怎么使用?
- WARNING: erroneous pipeline: no element "ffdec_h264
- interop – 在与C-version SDL2链接时从D隐藏控制台
- 异步 Ajax格式
- Cocos2d-x 2.2.3 + Visual studio 2013 + python2.7.5开发环