Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Postgresql Systemd service's options?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Ginta
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2006
Posts: 133
Location: Spain

PostPosted: Sun Jun 08, 2014 11:52 pm    Post subject: [Solved] Postgresql Systemd service's options? Reply with quote

I installed gentoo with systemd for the very first time (where first time refers to systemd), and I am encountering some problems I don't know how to resolve.

Also, I¡ve googled, and everything I found was to modify *.service files, which, I don't think it would be the best approach,

In this case, affected (mainly) service is postgresql-9.3.service

I have database located in another folder, and it worked good with initrc (I modifyed /etc/conf.d/postgresql-9.3 file), but now with systemd, it just refuses to take my directory locations.

As suggested by systemctl, I created the config file in /etc/systemd/system/postgresql-9.3.service.d/postgresql.conf which looks like:

Code:

[service]
Environment=PGPORT="5432"

# How long to wait for server to start in seconds
Environment=START_TIMEOUT=10

# NICE_QUIT ignores new connections and wait for clients to disconnect from
# server before shutting down. NICE_TIMEOUT in seconds determines how long to
# wait for this to succeed.
Environment=NICE_TIMEOUT=60

# Forecfully disconnect clients from server and shut down. This is performed
# after NICE_QUIT. Terminated client connections have their open transactions
# rolled back.
# Set RUDE_QUIT to "NO" to disable. RUDE_TIMEOUT in seconds.
Environment=RUDE_QUIT="YES"
Environment=RUDE_TIMEOUT=30

# If the server still fails to shutdown, you can force it to quit by setting
# this to YES and a recover-run will execute on the next startup.
# Set FORCE_QUIT to "YES" to enable. FORCE_TIMEOUT in seconds.
Environment=FORCE_QUIT="NO"
Environment=FORCE_TIMEOUT=2

# Extra options to run postmaster with, e.g.:
# -N is the maximal number of client connections
# -B is the number of shared buffers and has to be at least 2x the value for -N
# Please read the man-page to postmaster for more options. Many of these
# options can be set directly in the configuration file.
#PGOPTS="-N 512 -B 1024"

# Pass extra environment variables. If you have to export environment variables
# for the database process, this can be done here.
# Don't forget to escape quotes.
#PG_EXTRA_ENV="PGPASSFILE=\"/path/to/.pgpass\""

##############################################################################
#
# The following values should not be arbitrarily changed.
#
# `emerge --config dev-db/postgresql-server:9.2' uses these values to
# determine where to create the data directory, where to place the
# configuration files, and any additional options to pass to initdb.
#
# The initscript also uses these variables to inform PostgreSQL where to find
# its data directory and configuration files.
#
##############################################################################

# Location of configuration files
Environment=PGDATA="/data/Databases/PostgreSQL"

# Where the data directory is located/to be created
Environment=DATA_DIR="/data/Databases/PostgreSQL"

# Additional options to pass to initdb.
# See `man initdb' for available options.
Environment=PG_INITDB_OPTS="--locale=es_ES.UTF-8"


Furthermore, I saw that postgresql-9.3.service have DATA_DIR hardcoded.
When trying to execute it fails, and it status says:
Code:

● postgresql-9.3.service - PostgreSQL database server
   Loaded: loaded (/usr/lib64/systemd/system/postgresql-9.3.service; disabled)
  Drop-In: /etc/systemd/system/postgresql-9.3.service.d
           └─postgresql.conf
   Active: failed (Result: exit-code) since lun 2014-06-09 01:50:58 CEST; 9s ago
  Process: 4990 ExecStartPre=/usr/bin/postgresql-9.3-check-db-dir (code=exited, status=1/FAILURE)

jun 09 01:50:58 darkness postgresql-9.3-check-db-dir[4990]: Directory not found: /var/lib/postgresql/9.3/data
jun 09 01:50:58 darkness postgresql-9.3-check-db-dir[4990]: HINT: Ensure that DATA_DIR points to the right path.
jun 09 01:50:58 darkness postgresql-9.3-check-db-dir[4990]: HINT: Or perhaps you need to create the database cluster:
jun 09 01:50:58 darkness postgresql-9.3-check-db-dir[4990]: emerge --config dev-db/postgresql-server:9.3
jun 09 01:50:58 darkness systemd[1]: postgresql-9.3.service: control process exited, code=exited status=1
jun 09 01:50:58 darkness systemd[1]: Failed to start PostgreSQL database server.
jun 09 01:50:58 darkness systemd[1]: Unit postgresql-9.3.service entered failed state.


So it seems it is not getting my DATA_DIR config

Am I doing something wrong?
_________________
Somebody should use emerge brain on theirselves...
Back to top
View user's profile Send private message
Ginta
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2006
Posts: 133
Location: Spain

PostPosted: Mon Jun 09, 2014 2:44 am    Post subject: Reply with quote

I solved it, the problem was the " characters, and a typo in[service] directive (should be [Service] instead)

It seems that systemd expets its variables without ", like Environment PGPORT=5432 instead of Environment PGPORT="5432"
_________________
Somebody should use emerge brain on theirselves...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum