DEFINITIONS

Definitions More Info.
Definition ID12.098
TitlePOSTGRESQL
CategoryNOTES
Definitionpostgresql de ikinci instance kurulumu - ayni serverda
Definition Descriptiondiyelimki tüm postgresql 1. Instance ile kuruldu ve siz 2. Node kurmak istiyorsunuz.

1. Create new data directories for this second instance and let postgres user own them.
[root@serhattest 11]# cd /storage/data/pgsql/11/
[root@serhattest 11]# mkdir /storage/data/pgsql/11/stage/data
[root@serhattest 11]# mkdir /storage/backup/stagewal
[root@serhattest 11]# chown -R postgres:postgres /storage/data/pgsql/11/stage/data


2. Create new init script for this instance and edit it.
Copy the init script from first instance and rename it to postgresql-11-stage.service and edit it for making changes that reflect the new data directory
that we created in the above step.

start ettigi service burada
/usr/lib/systemd/system/postgresql-11.service

şimdi bunu kopyalayalım
cp postgresql-11.service postgresql-11-stage.service

sonra icerisini nano ile edit edelim
nano postgresql-11-stage.service

Environment=PGDATA=storage/data/pgsql/11/stage/data
Environment=PGPORT=5433

3. Initialize and start this new postgres instance (postgres kullanicisi ile)
/usr/pgsql-11/bin/initdb -D /storage/data/pgsql/11/stage/data -X /storage/backup/stagewal

4. Register New Instance With Systemctl
systemctl enable postgresql-11-stage
systemctl start postgresql-11-stage
systemctl status postgresql-11-stage

5. Test connectivity (root kullanicisi ile)
a) ps -ef | grep postmaster | grep postgres
b) systemctl list-unit-files | grep enabled | grep postgres
c) systemctl status postgresql-11 | grep port (default port)
d) systemctl status postgresql-11-stage | grep port (ikinci instance port)
e) postgres kullnacisi, komut satirinda : psql -p 5432 -d postgres
f) postgres kullnacisi, komut satirinda : psql -p 5433 -d postgres
RecordBycunay
Record Date08-05-2023 21:44:38
Düzenle
Kopyala
Sil