Sunday, November 30, 2014

19 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

19 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
  6. This is most likely the luckiest day in my life! I've just got my best essay and now I am here, looking at the solution I've been looking for long time ago. Thank you for posting this!

    ReplyDelete
  7. It proved to be Very helpful to me and I am sure to all the commentators here! vpn services

    ReplyDelete
  8. myTectra Placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance

    ReplyDelete

  9. Just seen your Article, it amazed me and surpised me with god thoughts that eveyone will benefit from it. It is really a very informative post for all those budding entreprenuers planning to take advantage of post for business expansions. You always share such a wonderful articlewhich helps us to gain knowledge .Thanks for sharing such a wonderful article, It will be deinitely helpful and fruitful article.
    Thanks
    DedicatedHosting4u.com

    ReplyDelete
  10. Great. It is good to constantly coming up with creative ideas. Provides much needed knowledge. goal oriented blog posts and always tried to find creative ways to meet goals.

    Thanks
    Online affiliates

    ReplyDelete

  11. This is a fantastic idea! I like it a lot because it's super easy for the audience to see the value of opting in. wonderful and amazing post very use full your post thanks for sharing your article
    Android Application development
    Web application

    ReplyDelete
  12. Your post is very good. I got to learn a lot from your post. Thank you for sharing your article for us. it is amazing post
    what is seo
    types of seo


    ReplyDelete
  13. Nice blog. OGEN Infosystem is leading Web Designing Company in Delhi, India, visit our website for web designing and SEO Services.
    Website Design Company

    ReplyDelete

  14. الرائد افضل شركات تنظيف خزانات المياه يسعدنا ان نقدم لكم افضل خدمات
    شركة غسيل خزانات بالمدينة المنورة تنظيف خزانات بالمدينة المنورة
    افضل شركة تنظيف منازل بالمدينة المنورة شركة تنظيف بيوت بالمدينة المنورة

    ReplyDelete

 

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