이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 2. Setting up Databases
2.1. Configuring PostgreSQL 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Running JBoss Operations Network on PostgreSQL requires three things:
- Adequate PostgreSQL settings for memory, timeouts, connections, and related settings
- A database
- A user with adequate permissions
JBoss ON supports PostgreSQL 8.2.4 and later 8.2.x versions, 8.3, 8.4, and 9.0.
2.1.1. Installing PostgreSQL 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
You can download the Microsoft Windows binaries you need from: https://www.postgresql.org/download/windows/
Use
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
To install a specific version of PostgreSQL, go to: https://yum.postgresql.org/rpmchart.php and download the
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
YUM
to install PostgreSQL:
sudo yum install postgresql postgresql-server
sudo yum install postgresql postgresql-server
postgresql, postgresql-server and postgresql-libs
RPM packages and install via yum
from the download directory. For example:
sudo yum install postgresql91-9.1.24-2PGDG.rhel6.x86_64.rpm postgresql91-libs-9.1.24-2PGDG.rhel6.x86_64.rpm postgresql91-server-9.1.24-2PGDG.rhel6.x86_64.rpm
sudo yum install
postgresql91-9.1.24-2PGDG.rhel6.x86_64.rpm
postgresql91-libs-9.1.24-2PGDG.rhel6.x86_64.rpm
postgresql91-server-9.1.24-2PGDG.rhel6.x86_64.rpm
2.1.2. Configuring PostgreSQL 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
For more detailed information about setting up client authentication for PostgreSQL users and databases, see the PostgreSQL documentation at http://www.postgresql.org/docs/8.4/interactive/client-authentication.html.
Note
Ensure that the Postgres authentication mechanism is properly configured for the configuration commands to work.
- Optional. Change the password for the Unix user for PostgreSQL:
sudo passwd postgres
sudo passwd postgres
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Initialize the database. The database must be initialized before starting the server.
service postgresql initdb
service postgresql initdb
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Start Postgres. For example, on Red Hat Enterprise Linux:
service postgresql start
service postgresql start
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On Windows:net start pgsql-8.3
net start pgsql-8.3
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set up a password for the
postgres
user on the database:su - postgres psql
# su - postgres $ psql postgres=# ALTER USER postgres PASSWORD 'password'; ALTER ROLE postgres=#
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a PostgreSQL role named
rhqadmin
, where 'password' should be replaced with a strong password.postgres=# CREATE USER rhqadmin PASSWORD 'password'; CREATE ROLE
postgres=# CREATE USER rhqadmin PASSWORD 'password'; CREATE ROLE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Important
Although the default postgresql credentials are userrhqadmin
and passwordrhqadmin
, these credentials should not be used as they present a security risk. Use these credentials are needed for Section 3.3, “Configuring the Server with the Web Installer” or Section 3.4, “Silently Installing the JBoss ON Server”. - Create a PostgreSQL database named
rhq
, specifying therhqadmin
role as the owner.postgres=# CREATE DATABASE rhq OWNER rhqadmin; CREATE DATABASE
postgres=# CREATE DATABASE rhq OWNER rhqadmin; CREATE DATABASE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Give users on the computer access to the database. To allow all users, add the appropriate connection settings for each connection type (local, IPv4, and IPv6) to the
data/pg_hba.conf
configuration file, for both local and external connections:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Usingall all
sets these settings for every user to every PostgreSQL database. This settings can be applied to only the JBoss ON database by usingrhq all
or even to specific users for JBoss ON, such asrhq rhqadmin
.Then, restart the database service.service postgresql restart
service postgresql restart
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Make the configuration changes in Section 2.1.3, “Setting PostgreSQL Parameters”.
2.1.3. Setting PostgreSQL Parameters 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
There are several settings in the PostgreSQL server configuration that can be tuned to provide better performance for JBoss ON.
2.1.3.1. Editing the postgresql.conf File 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
PostgreSQL requires minor changes to the database configuration in the
postgresql.conf
file.
- Make sure that an adequate amount of memory and system resources are assigned to accommodate the JBoss ON database.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For PostgreSQL 8.2.4 and 8.3, also set themax_fsm_pages
parameter. (This parameter should not be used on PostgreSQL 8.4 and later databases.)max_fsm_pages = 100000 # default is 204800
max_fsm_pages = 100000 # default is 204800
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Optional. Set the statement timeout period so a size that is adequate to handle data compression in large environments. By default, the default is zero (0) seconds, which means there is no statement timeout set; not having a timeout period is the preferred setting for smaller deployments.
statement_timeout = 0s # default is 0s
statement_timeout = 0s # default is 0s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
If there is already a global statement timeout period for that database, but you need to use a larger setting for JBoss ON, set a user-level statement timeout value that only applies to the JBoss ON user.ALTER USER rhqadmin SET statement_timeout=600000;
ALTER USER rhqadmin SET statement_timeout=600000;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - JBoss ON can use up to 55 database connections for the server. PostgreSQL also allows for connections reserved for administrators. These connections are counted in the pool of
max_connections
and therefore need to be added to the total number ofmax_connections
. For example, if there are five connections reserved for the administrator, edit thepostgresql.conf
file as follows:max_connections = 60 # default is 100 superuser_reserved_connections = 5 # default is 3 max_prepared_transactions = 60 # default is 5 (in v8.3) or 0 (in v8.4)
max_connections = 60 # default is 100 superuser_reserved_connections = 5 # default is 3 max_prepared_transactions = 60 # default is 5 (in v8.3) or 0 (in v8.4)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
max_prepared_transactions
is set to the same value asmax_connections
, as explained in the "max_prepared_transactions (integer)" in the PostgreSQL documentation.If JBoss ON is also monitoring this database instance, add one more connection per (logical) database that is set up in PostgreSQL. For further information about this plug-in, see the Postgres server section of the Resource Monitoring Reference.
2.1.3.2. Setting Kernel Parameters 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Consider adjusting the kernel parameters for your system. The PostgreSQL documentation on Managing Kernel Resources has more information.
2.1.3.3. Editing pg_hba.conf 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Update the
pg_hba.conf
file to allow the newly-created role to connect from the machine the JBoss ON server is installed on, such as localhost. Adding client connections is covered in the PostgreSQL documentation in the Client Authentication section.
After editing the
pg_hba.conf
file, restart PostgreSQL for the changes to take effect. If no errors are displayed, the database is now ready to support a JBoss ON installation.
For more information on tuning Postgres, see the PostgreSQL documentation about Tuning your PostgreSQL Server.
2.1.3.4. Fixes for "Relation RHQ_Principal does not exist" Error 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Sometimes the database connection is marked as valid but the install still fails with the Relation RHQ_Principal does not exist error. This occurs when a new database is created by running
initdb
in a non-C
locale through PostgreSQL instances.
To fix this error:
- Using a database explorer, create an empty table called
RHQ_PRINCIPAL
in the database used for JBoss ON. - Click Install server.The installer displays a warning about an existing schema. Overwrite the existing schema as it only consists of one empty table.
Another option is to specify the encoding of the created database as
SQL-ASCII
at creation time. For example:
initdb -D /my/test/data -E SQL_ASCII --locale en_US.UTF-8
initdb -D /my/test/data -E SQL_ASCII --locale en_US.UTF-8