Re: Proposed enhancement to the init.d script - Mailing list pgsql-pkg-yum

From Gudmundsson Martin (mg)
Subject Re: Proposed enhancement to the init.d script
Date
Msg-id 2E5766F28426E547AF0A2A870FAE630D17C652@SEGOTNC5182-N2.vcn.ds.volvo.net
Whole thread Raw
In response to Proposed enhancement to the init.d script  ("Gudmundsson Martin (mg)" <martin.mg.gudmundsson@volvo.com>)
List pgsql-pkg-yum
Hi!
Attached is a patch for my request.

Added the possibility to add the parameter PGXLOG to an environment file in /etc/sysconfig/pgsql/ and have it picked up
bythe initdb function.
 
I also removed some strange indention for the LOCALE parameter section in that function.

I tested this with the following environment in /etc/sysconfig/pgsql/pgtest01
PGENGINE=/usr/pgsql-9.3/bin
PGPORT=5440
PGDATA=/var/lib/pgsql/data/9.3/pgtest01
PGLOG=/var/lib/pgsql/log/pgtest01/pgstartup.log
PGXLOG=/var/lib/pgsql/xlog/9.3/pgtest01

Created the link in /etc/init.d
# ln -s postgresql-9.3 pgtest01

Created the needed directories and set the correct owner:
# mkdir -p /var/lib/pgsql/data/9.3/pgtest01
# mkdir -p /var/lib/pgsql/log/pgtest01
# mkdir -p /var/lib/pgsql/xlog/9.3/pgtest01
# chown postgres:postgres /var/lib/pgsql/data/9.3/pgtest01
# chown postgres:postgres /var/lib/pgsql/xlog/9.3/pgtest01
# chown postgres:postgres /var/lib/pgsql/log/pgtest01

Use the follwing commands to initdb and start the postgres server:
# service pgtest01 initdb
# service pgtest01 start

To start on boot add
# chkconfig pgtest01 on

Please review and let me know what you think.

Best regards, Martin 

-----Original Message-----
From: Gudmundsson Martin (mg) 
Sent: den 14 oktober 2013 9:33
To: 'Devrim GÜNDÜZ'
Cc: pgsql-pkg-yum@postgresql.org
Subject: RE: [pgsql-pkg-yum] Proposed enhancement to the init.d script

Hi!
Hmm your email ended up in my Junk mail folder, so sorry for my late response.

Yes, that would've been good, but no rush.

Anyway, I also did see that LOCALE could be specified as input to the initdb function.
Perhaps it would be reasonable to add that as well as an option in the /etc/sysconfig/pgsql files?

I will look into a patch, hopefully in the coming week or so.

Best regards, Martin 


-----Original Message-----
From: Devrim GÜNDÜZ [mailto:devrim@gunduz.org] 
Sent: den 10 oktober 2013 1:14
To: Gudmundsson Martin (mg)
Cc: pgsql-pkg-yum@postgresql.org
Subject: Re: [pgsql-pkg-yum] Proposed enhancement to the init.d script

Hi Martin,

Sounds good to me. I wish you sent this mail 2 days before, while we
were working on updated releases, so that we could add this feature to
today's updates.

I created http://wiki.pgrpms.org/ticket/145 for this, and added you as a
CC, so that you can see the progress. I think  we can add this feature
in next update set.

Regards, Devrim
  
On Thu, 2013-10-10 at 06:51 +0000, Gudmundsson Martin (mg) wrote:
> Hi!
> I'm using the intit.d scripts to start our Postgres clusters. Also I am  creating new files in /etc/sysconfig/pgsql
andnew links in /etc/init.d if I want new clusters.
 
> 
> I would like support in the init.d script, in the initdb function to also specify pg_xlog path, if specified in
/etc/sysconfig/pgsqlfile.
 
> 
> So, let's say I have the following in /etc/sysconfig/pgsql/secondary-9.3:
> 
> PGENGINE=/usr/pgsql-9.3/bin
> PGPORT=5432
> PGDATA=/var/lib/pgsql/9.3/data
> PGLOG=/var/lib/pgsql/9.3/pgstartup.log
> PGXLOG=/var/lib/pgsql/9.3/xlog                # Added by me :)
> 
> And then have the initdb function check for PGXLOG environment variable and if set, call initdb with -X $PGXLOG.
> 
> If this would be put in place it would be easier to automatically provision new postgres clusters according to our
standardsby using standard RHEL system commands from puppet, cfengine etc.
 
> Then we just create a new file in /etc/sysconfig/pgsql with the settings for the new cluster, create a link in
/etc/init.dfrom secondary-9.3 to postgres-9.3.
 
> Then we just do:
> # service secondary-9.3 initdb
> # service secondary-9.3 start
> # chkconfig secondary-9.3 on
> 
> And we would have a fully functional postgres cluster with xlog and data separated.
> 
> Would this be something that would be possible to implement? I could probably write a patch if wanted.
> 
> Best regards,
> 
> Martin Gudmundsson
> Database Technical Specialist
> Infrastructure Architect
> 
> Volvo Information Technology
> IMO Java Database Gothenburg
> Dept DE56720, DA2N
> SE-405 08 Gothenburg, Sweden
> Tel: +46 31 3224333
> Email: martin.mg.gudmundsson@volvo.com
> P Please consider your environmental responsibility. Before printing this e-mail ask yourself:- "Do I need a hard
copy?"
> 
> 
> 


-- 
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Attachment

pgsql-pkg-yum by date:

Previous
From: "Gudmundsson Martin (mg)"
Date:
Subject: Re: Proposed enhancement to the init.d script
Next
From: Rafael Martinez
Date:
Subject: Change of the PID file in a minor version