From Fedora Project Wiki

No edit summary
(→‎PostgreSQL: expand on usage of custom service files)
Line 6: Line 6:


=== PostgreSQL ===
=== PostgreSQL ===
In the case of PostgreSQL, the "service postgresql initdb" and "service postgresql upgrade" actions that were supported by the SysV init script cannot be provided by the systemd unit file.  There is a new standalone script postgresql-setup that provides these functions.  For example, to initialize a new postgresql database, do something like
The "service postgresql initdb" and "service postgresql upgrade" actions that were supported by the SysV init script cannot be provided by the systemd unit file.  There is a new standalone script postgresql-setup that provides these functions.  For example, to initialize a new postgresql database, do something like


<code>
<code>
Line 12: Line 12:
</code>
</code>


If you need to run more than one postgresql server on the same machine, you can duplicate and modify the <code>postgresql.service</code> file, as is customary with systemd services.  Add the name of the new service file when you call postgresql-setup to have it extract the PGDATA setting from that service file instead of <code>postgresql.service</code>.
If you need to run more than one postgresql server on the same machine, you can duplicate and modify the <code>postgresql.service</code> file, as is customary with systemd services.  (Remember that custom service files should go into <code>/etc/systemd/system/</code> not <code>/lib/systemd/system/</code>.)  Notice that PGDATA and PGPORT settings for alternate servers must now be specified in the custom service files; there is no longer any use of files in <code>/etc/sysconfig/pgsql/</code>.
 
You can use postgresql-setup for an alternate server by adding the name of the new service file to the command, for instance
 
<code>
sudo postgresql-setup initdb myservice
</code>
 
postgresql-setup will then extract the PGDATA setting from that service file instead of <code>postgresql.service</code>.


[[Category:Docs Project]]
[[Category:Docs Project]]
[[Category:Draft documentation]]
[[Category:Draft documentation]]
[[Category:Documentation beats]]
[[Category:Documentation beats]]

Revision as of 18:23, 3 September 2011

DocsProject Header docTeam1.png
Note.png
Beat is open
This beat is now ready to have Fedora 25 content added by the beat writer


systemd

MySQL and PostgreSQL have been updated to use native systemd unit files for startup, in place of the SysV-style init scripts. This should eliminate various unfortunate problems that occurred in Fedora 15 due to systemd's rather poor handling of SysV scripts. Also, handling of cases where the database server is slow to start up is significantly better than it ever was in the SysV scripts, since in systemd there is no reason not to wait until the server is really ready.

PostgreSQL

The "service postgresql initdb" and "service postgresql upgrade" actions that were supported by the SysV init script cannot be provided by the systemd unit file. There is a new standalone script postgresql-setup that provides these functions. For example, to initialize a new postgresql database, do something like

sudo postgresql-setup initdb

If you need to run more than one postgresql server on the same machine, you can duplicate and modify the postgresql.service file, as is customary with systemd services. (Remember that custom service files should go into /etc/systemd/system/ not /lib/systemd/system/.) Notice that PGDATA and PGPORT settings for alternate servers must now be specified in the custom service files; there is no longer any use of files in /etc/sysconfig/pgsql/.

You can use postgresql-setup for an alternate server by adding the name of the new service file to the command, for instance

sudo postgresql-setup initdb myservice

postgresql-setup will then extract the PGDATA setting from that service file instead of postgresql.service.