Last active
August 10, 2018 13:53
-
-
Save f9n/1bdf5201861b81424dfec2c42b2f006a to your computer and use it in GitHub Desktop.
Postgresql error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(root)# systemctl start postgresql | |
Job for postgresql.service failed because the control process exited with error code. | |
See "systemctl status postgresql.service" and "journalctl -xe" for details | |
(root)# systemctl status postgresql | |
● postgresql.service - PostgreSQL database server | |
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) | |
Active: failed (Result: exit-code) since Mon 2017-03-06 07:52:38 UTC; 12s ago | |
Process: 10052 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=1/FAILURE) | |
CPU: 6ms | |
Mar 06 07:52:38 <YourHostName> systemd[1]: Starting PostgreSQL database server... | |
Mar 06 07:52:38 <YourHostName> systemd[1]: postgresql.service: Control process exited, code=exited status=1 | |
Mar 06 07:52:38 <YourHostName> systemd[1]: Failed to start PostgreSQL database server. | |
Mar 06 07:52:38 <YourHostName> systemd[1]: postgresql.service: Unit entered failed state. | |
Mar 06 07:52:38 <YourHostName> systemd[1]: postgresql.service: Failed with result 'exit-code'. | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Solution(https://bbs.archlinux.org/viewtopic.php?id=151593) | |
(root)# chown -R postgres:postgres /var/lib/postgres/ | |
(root)# su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/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.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 /var/lib/postgres/data ... ok | |
creating subdirectories ... ok | |
selecting default max_connections ... 100 | |
selecting default shared_buffers ... 128MB | |
selecting dynamic shared memory implementation ... posix | |
creating configuration files ... ok | |
running bootstrap script ... ok | |
performing post-bootstrap initialization ... 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: | |
pg_ctl -D /var/lib/postgres/data -l logfile start | |
(root)# systemctl status postgresql | |
● postgresql.service - PostgreSQL database server | |
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) | |
Active: active (running) since Mon 2017-03-06 07:56:19 UTC; 1s ago | |
Process: 10168 ExecStart=/usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 (code=exited, status=0/SUCCESS) | |
Process: 10150 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=0/SUCCESS) | |
Main PID: 10172 (postgres) | |
Tasks: 6 (limit: 4915) | |
Memory: 15.0M | |
CPU: 37ms | |
CGroup: /system.slice/postgresql.service | |
├─10172 /usr/bin/postgres -D /var/lib/postgres/data | |
├─10181 postgres: checkpointer process | |
├─10182 postgres: writer process | |
├─10183 postgres: wal writer process | |
├─10184 postgres: autovacuum launcher process | |
└─10185 postgres: stats collector process | |
Mar 06 07:56:17 father systemd[1]: Starting PostgreSQL database server... | |
Mar 06 07:56:18 father postgres[10168]: LOG: database system was shut down at 2017-03-06 07:56:08 UTC | |
Mar 06 07:56:18 father postgres[10168]: LOG: MultiXact member wraparound protections are now enabled | |
Mar 06 07:56:18 father postgres[10168]: LOG: database system is ready to accept connections | |
Mar 06 07:56:18 father postgres[10168]: LOG: autovacuum launcher started | |
Mar 06 07:56:19 father systemd[1]: Started PostgreSQL database server. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Depending on the version , initialization would be (my version was 9.6)
su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/pgsql/data/'"