Postgresql 在 ubuntu 中更改数据目录 [英] Postgresql changing data directory in ubuntu

查看:26
本文介绍了Postgresql 在 ubuntu 中更改数据目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<块引用>

可能的重复:
Postgresql 启动失败

这个问题一直让我发疯,似乎没有任何效果.我需要更改 postgresql 存储数据库的位置.在终端中使用命令时,我是一个完整的新手,使用正确命令的分步说明真的很有帮助.我在整个网络上进行了搜索,但所有说明都假定对终端命令有一些先验知识.我确实尝试了一种方法,在主数据文件夹中创建一个指向我所需位置的符号链接.这给了我一个错误,要求我检查日志文件.但是,我不知道日志文件在哪里.很多人似乎都有这个问题,一步一步的解决方案肯定会有所帮助.我的 Psql 版本是 8.4.Ubuntu 10.10

解决方案

最新的日志文件完整路径是 /var/log/postgresql/postgresql-8.4-main.log 但符号链接是不是更改数据位置的更集成/更简单的方法.

我建议通过使用 将整个集群创建到所需位置来实现pg_createcluster 命令随 debian/ubuntu postgres 包一起提供.

1- 删除您当前的集群,如果它不包含任何先前的数据:

<块引用>

$ sudo pg_dropcluster --stop 8.4 main

2- 在新位置创建一个新集群

<块引用>

$ sudo pg_createcluster -d/path/to/new/location 8.4 main

3- 重启 postgresql

<块引用>

$ sudo/etc/init.d/postgresql start

Possible Duplicate:
Postgresql failed to start

This problem has been driving me crazy and nothing seems to be working. I need to change the location where postgresql stores the data base. I am a complete novice when it comes to using commands in the terminal and step by step instructions with the proper commands would really help. I searched all over the web but all instructions assume some prior good knowledge to terminal commands. I did try one approach by creating a symbolic link in the main data folder to my required location. This gives me an error that asks me to check the log file. However, I have no idea where the log file is. A lot of people seem to have this problem and a step by step solution would surely help. My Psql version is 8.4. Ubuntu 10.10

解决方案

The latest log file full path is /var/log/postgresql/postgresql-8.4-main.log but the symbolic link is not the more integrated/easy way to change the data location.

I'd suggest to do it by creating the entire cluster to the desired location, with the pg_createcluster command that comes with the debian/ubuntu postgres packages.

1- delete your current cluster, if it does not contain any prior data:

$ sudo pg_dropcluster --stop 8.4 main

2- create a new cluster at the new location

$ sudo pg_createcluster -d /path/to/new/location 8.4 main

3- restart postgresql

$ sudo /etc/init.d/postgresql start

这篇关于Postgresql 在 ubuntu 中更改数据目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆