![]() ![]() 12:20:22.540 CEST LOG: performing immediate shutdown because data directory lock file is invalid 12:20:22.540 CEST LOG: could not open file "postmaster.pid": No such file or directory 12:20:17.756 CEST LOG: database system is shut downĪgain, this does not work and even the initial instance was shutdown because PostgreSQL detected that the lock file is not there anymore: 12:20:17.756 CEST FATAL: could not create any TCP/IP sockets 12:20:17.756 CEST WARNING: could not create listen socket for "localhost" 12:20:17.756 CEST LOG: could not bind IPv4 address "127.0.0.1": Address already in use 12:20:17.756 CEST HINT: Is another postmaster already running on port 8888? If not, wait a few seconds and retry. 12:20:17.756 CEST LOG: could not bind IPv6 address "::1": Address already in use Lets remove that file and try again: :/home/postgres/ rm /var/tmp/pgtest/postmaster.pid Ls: cannot access '/var/tmp/pgtest/postmaster.pid': No such file or directoryĪt least by default this is not possible to start two or more instances as PostgreSQL checks if postmaster.pid already exists. :/home/postgres/ ls -al /var/tmp/pgtest/postmaster.pid 12:48:50.685 CEST LOG: database system is shut down 12:48:50.651 CEST LOG: background worker "logical replication launcher" (PID 7903) exited with exit code 1 12:48:50.641 CEST LOG: aborting any active transactions 12:48:50.636 CEST LOG: received fast shutdown request Once the instance is stopped the file is removed: :/home/postgres/ pg_ctl -D /var/tmp/pgtest/ stop If that file exists PostgreSQL will not start up another instance against the same data directory. When PostgreSQL is starting up it will look at a file called “postmaster.pid” which exists in the data directory once the instance is started. 12:18:26.252 CEST HINT: Is another postmaster (PID 7607) running in data directory "/var/tmp/pgtest"? 12:18:26.252 CEST FATAL: lock file "postmaster.pid" already exists Pg_ctl: another server might be running trying to start server anyway What happens when we want to start another instance against that data directory? :/home/postgres/ pg_ctl -D /var/tmp/pgtest start ![]() :/home/postgres/ psql -p 8888 -c "select version()" postgres 12:17:22.455 CEST LOG: database system is ready to accept connections 12:17:22.446 CEST LOG: database system was shut down at 12:16:54 CEST :/home/postgres/ pg_ctl -D /var/tmp/pgtest start We use a dedicated port and then start it up: :/home/postgres/ export PGPORT=8888 Pg_ctl -D /var/tmp/pgtest/ -l logfile start You can now start the database server using: auth-local and -auth-host, the next time you run initdb. ![]() You can change this by editing pg_hba.conf or using the option -A, or Initdb: warning: enabling "trust" authentication for local connections ![]() Performing post-bootstrap initialization. Selecting dynamic shared memory implementation. The default text search configuration will be set to "english".įixing permissions on existing directory /var/tmp/pgtest. The default database encoding has accordingly been set to "UTF8". The database cluster will be initialized with locales This user must also own the server process. The files belonging to this database system will be owned by user "postgres". To start with we create a new cluster: :/home/postgres/ mkdir /var/tmp/pgtestġ2:16:46 :/home/postgres/ initdb -D /var/tmp/pgtest/ In this post we will look at how PostgreSQL is detecting that and what mechanism are build in to avoid the situation of having multiple instances working against the same files on disk. If that would work the result can only be corruption. like Oracle RAC) it should not be possible to start two or more instances against the same data directory. As PostgreSQL does not know the concept of running multiple instances against the same files on disk (e.g. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |