Sunday, November 30, 2014

6 Install/configure multiple postgreSQL instances on Centos 7 with systemctl

In this post, I am going to create three postgreSQL instance on the same host. I can not seem to find right twiki for how to do it therefore I create this article  in case if other people may want to do the same.

Install Centos 7

image

image

image

image

image

use ip addr to check the networking

image

Post configuration for Centos 7

# install some package I like to have
yum install perl gcc gpm screen kernel-devel net-tools patch wget
init 6
 
# install vmware-tools 
mkdir cdrom
mount /dev/cdtom /media/cdrom
tar xvzf /media/cdrom/VMwareTools-9.2.2-893683.tar.gz
vmware-install.pl

I encounter the issue for install the vmware-tools. It seems to be the issue on the VMWare-tools that can not work in the Centos7 but I can not find the solutions. 

image

Add user : postsqldba and create .screenrc

useradd postsqldba
passwd postsqldba

Login as postsqldba. Here is my .screenrc

# Start message
startup_message off
 
escape ^Xx
# Set hardstatus always on
 
caption always "%{=u .d} %-w%<%{=ub .B}%n %t%{=u .d}%+w "
hardstatus alwaysignore
hardstatus alwayslastline "%{= .K} [%l]%<%=%{= .W}@%H %=%{= .y} %Y %M %d(%D) %{= .m} %C %A"
 
# Set default encoding using utf8
defutf8 on
 
# Refresh the display when exiting programs
altscreen on
 
# Dynamic title
shelltitle '$ |bash'
 
# Disable vbell
vbell off
 
# Keboard binding
# bind F11 to move to previous window
bindkey -k F1 prev
# bind F12 to move to next window
bindkey -k F2 next
# bind Alt`~= to screen0~12
bindkey "^[`" select 0
bindkey "^[1" select 1
bindkey "^[2" select 2
bindkey "^[3" select 3
bindkey "^[4" select 4
bindkey "^[5" select 5
bindkey "^[6" select 6
bindkey "^[7" select 7
bindkey "^[8" select 8
bindkey "^[9" select 9
bindkey "^[0" select 10
bindkey "^[-" select 11
bindkey "^[=" select 12
# bind F7 to detach screen session (to background)
bindkey -k k7 detach
# bind F8 to kill current screen window
bindkey -k k8 kill
# bind F9 to create a new screen
bindkey -k k9 screen
# bind F10 to rename current screen window
bindkey -k k; title

Install PostgreSQL 9.3

The yum repository does not have the latest postgre 9.3. Therefore we have to manually install from postgresql.org.

yum install http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
yum install postgresql93-server postgresql93-contrib

image

Post install : initdb

/usr/pgsql-9.3/bin/initdb -D /home/postsqldba/inst1 -U  postsqldba
/usr/pgsql-9.3/bin/initdb -D /home/postsqldba/inst2 -U  postsqldba

image

Create service file

create /etc/systemd/system/postgresql-*.service for each instance.

.include /lib/systemd/system/postgresql-9.3.service
 
[Service]
Environment=PGDATA=/home/postsqldba/inst1
Environment=PGPORT=7001
User=postsqldba
Group=postsqldba

image

Register new instance with systemctl

systemctl enable postgresql-inst1
systemctl start postgresql-inst1
systemctl status postgresql-inst1
 
systemctl enable postgresql-inst2
systemctl start postgresql-inst2
systemctl status postgresql-inst2

image

Test connectivity

image

Trouble shooting with systemctl

journalctl -xn

6 comments:

  1. Thanks i was searching for a while to find a robust multiple pgsql instances installation with systemd.

    ReplyDelete
  2. The code for this project should be error free in order to make the desired result.There are many developers who do not understand the procedure of making the appropriate codes for the code.The benefits of the code should be right like as the http://www.procustomwriting.com/custom-research-papers for the students who are looking for the helps to get their desired assignment just in time.

    ReplyDelete
  3. Yeah, thank you, that's useful as hell. So, there is the only question stayed: " Where to play Sizzling hot slot? ". Or not question.. Yeah, not anymore. If you have time after installation, go there and take a break.

    ReplyDelete
  4. Thank you for the video it was very useful for me. Modern technologies are really changed our world and now we can meeting people over the world and meeting with a girlfriend or with a boyfriend without leaving a room. Check it here.

    ReplyDelete
  5. I read this article. I think You put a lot of effort to create this article. I appreciate your work. Frip thanks

    ReplyDelete

 

SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates