PostgreSQL“ initdb” Linux上的(数据库初始化) [英] PostgreSQL "initdb" (Database Initialization) on Linux

查看:574
本文介绍了PostgreSQL“ initdb” Linux上的(数据库初始化)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Linux上(CentOS-RedHat-Fedora)上使用PostgreSQL 9.x创建数据库集群(单个数据库)。我已经安装了正确的PostgreSQL软件包(服务器和客户端),但是无法创建数据库并得到某种初始化依赖项错误:总线错误/退出代码135 。我已经用 su postgres将用户更改为 postgres,然后尝试使用 initdb初始化数据库(这可能是问题所在)

I'm working on creating a Database Cluster (single database) in PostgreSQL 9.x working on a Linux system (CentOS - RedHat - Fedora). I've installed the correct PostgreSQL packages (server & client) however, I'm unable to create a database and get some type of initializing dependencies error: Bus Error / Exit Code 135. I've changed my user to "postgres" with "su postgres" and then tried to initialize the database with "initdb" (this may be the problem)

Installed: postgresql-libs-9.2.13-1.el7_1.x86_64
Installed: postgresql-9.2.13-1.el7_1.x86_64
Installed: postgresql-server-9.2.13-1.el7_1.x86_64

$ initdb -D /usr/local/pgsql/data

http://www.postgresql.org/ docs / 9.2 / interactive / creating-cluster.html

错误:

$ initdb -D /usr/local/pgsql/data
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.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... sh: line 1: 12616 Bus error               (core dumped) "/usr/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true template1 > /dev/null
child process exited with exit code 135

有什么想法吗?

推荐答案

安装PostgreSQL(服务器和客户端工具)后,需要以ROOT( su)身份运行以下命令。关键步骤是启动 service postgresql initdb,并使其初始化PostgreSQL数据库。

After installing PostgreSQL (server and client tools) one needs to run the following commands as ROOT ("su"). The key step is to start "service postgresql initdb" and let it initialize your PostgreSQL database.

如果有任何错误,则需要删除空的 data安装目录并仔细阅读所有日志文件。

If you have any errors you need to remove the empty install "data" directories and read all log files carefully.

# service postgresql initdb
# systemctl enable postgresql
# systemctl start postgresql

完成上述操作后,验证postgres是否在/ var / lib / pgsql中并且正在运行 ps -ef | grep postgres(位于端口5432上)

After doing the above verify that postgres is in /var/lib/pgsql and a running process with "ps -ef | grep postgres" (its on port 5432)

如果遇到其他任何问题,则可能需要创建或修改postgres用户/密码或清除一个postgres数据目录。

If you run into any other problems you may need to create or modify a postgres user/password or clean a postgres data directory out.

这篇关于PostgreSQL“ initdb” Linux上的(数据库初始化)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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