PostgreSQL is an alternative to MySQL that’s loaded with tons of features better than many other databases. And so many people prefer it over MySQL. Go figure.
To install PostgreSQL:
$ sudo apt-get -y install postgresql python-psycopg2
The unsettlingly named package python-psycopg2 provides the Python interface to PostgreSQL. One change to note is that the change in representation of PostgreSQL. It has to be in this form:
postgresql://<user>:<password>@<host>/<db>
Log in as PostgreSQL user and create the roles that are needed for each services. Roles are like users:
$ sudo su - postgres % psql psql##> create role keystoneUser; psql##> create role glanceUser; psql##> create role cinderUser; psql##> create role neutronUser; psql##> create role novaUser;
Now log into PostgreSQL , set passwords and create databases.
% psql psql##> \password keystoneUser psql##> \password glanceUser psql##> \password neutronUser psql##> \password novaUser psql##> \password cinderUser psql##> CREATE DATABASE keystone; psql##> CREATE DATABASE glance; psql##> CREATE DATABASE neutron; psql##> CREATE DATABASE nova; psql##> CREATE DATABASE cinder;
Grant privileges to appropriate users of the database.
psql##> GRANT ALL PRIVILEGES ON DATABASE keystone TO keystoneUser; psql##> GRANT ALL PRIVILEGES ON DATABASE glance TO glanceUser; psql##> GRANT ALL PRIVILEGES ON DATABASE neutron TO neutronUser; psql##> GRANT ALL PRIVILEGES ON DATABASE nova TO novaUser; psql##> GRANT ALL PRIVILEGES ON DATABASE cinder TO cinderUser; psql##> GRANT ALL PRIVILEGES ON DATABASE swift TO swiftUser;
To set up SQL Alchemy do the following in the [sql] sections of appropriate configuration files:
connection = postgresql://keystoneUser:keystonePass@10.0.0.1/keystone connection = postgresql://glanceUser:glancePass@10.0.0.1/glance connection = postgresql://neutronUser:neutronPass@10.0.0.1/neutron connection = postgresql://novaUser:novaPass@10.0.0.1/nova connection = postgresql://cinderUser:cinderPass@10.0.0.1/cinder connection = postgresql://swiftUser:swiftPass@10.0.0.1/swift
If you are migrating from MySQL, you need to export database from MySQL into PostgreSQL. If you are doing a new installation, do db_sync like so:
# keystone-manage db_sync # glance-manage db_sync # nova-manage db sync