Este conteúdo não está disponível no idioma selecionado.
Appendix D. Preparing a Remote PostgreSQL Database for Use with the Red Hat Virtualization Manager
Optionally configure a PostgreSQL database on a remote Red Hat Enterprise Linux 7 machine to use as the Manager database. By default, the Red Hat Virtualization Manager's configuration script,
engine-setup, creates and configures the Manager database locally on the Manager machine. For automatic database configuration, see Section 3.3, “Configuring the Red Hat Virtualization Manager”. To set up the Manager database with custom values on the Manager machine, see Appendix E, Preparing a Local Manually-Configured PostgreSQL Database for Use with the Red Hat Virtualization Manager.
Use this procedure to configure the database on a machine that is separate from the machine where the Manager is installed. Set up this database before you configure the Manager; you must supply the database credentials during
engine-setup.
Note
The
engine-setup and engine-backup --mode=restore commands only support system error messages in the en_US.UTF8 locale, even if the system locale is different.
The locale settings in the
postgresql.conf file must be set to en_US.UTF8.
Important
The database name must contain only numbers, underscores, and lowercase letters.
Procedure D.1. Preparing a Remote PostgreSQL Database for use with the Red Hat Virtualization Manager
- Install the PostgreSQL server package:
yum install postgresql-server
# yum install postgresql-serverCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Initialize the PostgreSQL database, start the
postgresqlservice, and ensure that this service starts on boot:su -l postgres -c "/usr/bin/initdb --locale=en_US.UTF8 --auth='ident' --pgdata=/var/lib/pgsql/data/" systemctl start postgresql.service systemctl enable postgresql.service
# su -l postgres -c "/usr/bin/initdb --locale=en_US.UTF8 --auth='ident' --pgdata=/var/lib/pgsql/data/" # systemctl start postgresql.service # systemctl enable postgresql.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Connect to the psql command line interface as the
postgresuser:su - postgres psql
# su - postgres $ psqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a user for the Manager to use when it writes to and reads from the database. The default user name on the Manager is
engine:postgres=# create role user_name with login encrypted password 'password';
postgres=# create role user_name with login encrypted password 'password';Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a database in which to store data about the Red Hat Virtualization environment. The default database name on the Manager is
engine:postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Connect to the new database and add the
plpgsqllanguage:postgres=# \c database_name database_name=# CREATE LANGUAGE plpgsql;
postgres=# \c database_name database_name=# CREATE LANGUAGE plpgsql;Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Ensure the database can be accessed remotely by enabling md5 client authentication. Edit the
/var/lib/pgsql/data/pg_hba.conffile, and add the following line immediately underneath the line starting withlocalat the bottom of the file, replacing X.X.X.X with the IP address of the Manager:host database_name user_name X.X.X.X/32 md5
host database_name user_name X.X.X.X/32 md5Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Allow TCP/IP connections to the database. Edit the
/var/lib/pgsql/data/postgresql.conffile and add the following line:listen_addresses='*'
listen_addresses='*'Copy to Clipboard Copied! Toggle word wrap Toggle overflow This example configures thepostgresqlservice to listen for connections on all interfaces. You can specify an interface by giving its IP address. - Open the default port used for PostgreSQL database connections, and save the updated firewall rules:
yum install iptables-services iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT service iptables save
# yum install iptables-services # iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT # service iptables saveCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the
postgresqlservice:systemctl restart postgresql.service
# systemctl restart postgresql.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Optionally, set up SSL to secure database connections using the instructions at http://www.postgresql.org/docs/9.2/static/ssl-tcp.html#SSL-FILE-USAGE.