Cloudera Enterprise 6.0 Beta | Other versions

Step 5: Set up the Cloudera Manager Database

Step 1: Configure a Repository for Cloudera Manager

Step 2: Install Java Development Kit

Step 3: Install Cloudera Manager Server

Step 4: Install and Configure Databases for Cloudera Software

Step 5: Set up the Cloudera Manager Database

Step 6: Install CDH and Other Software Using the Wizard

Step 7: Set Up a Cluster Using the Wizard

Cloudera Manager Server includes a script that configures a database for itself. The script:

  • Creates the Cloudera Manager Server database configuration file.
  • (MariaDB and MySQL) Creates a database for Cloudera Manager Server to use.
  • (MariaDB, MySQL, and PostgreSQL) Creates and configures a user account for Cloudera Manager Server.

The following sections describe the syntax for the script and demonstrate how to use it:

Syntax for scm_prepare_database.sh

/opt/cloudera/cm/schema/scm_prepare_database.sh [options] <databaseType> <databaseName> <databaseUser>
  Note: You can also run scm_prepare_database.sh without options to see the syntax.
Table 1. Required Parameters
Parameter Description
<databaseType> One of the supported database types:
  • MariaDB: mysql
  • MySQL: mysql
  • Oracle: oracle
  • PostgreSQL: postgresql
<databaseName> The name of the Cloudera Manager Server database to use. For MySQL, MariaDB, and PostgreSQL databases, the script can create the specified database if you specify the -u and -p options with the credentials of a user that has privileges to create databases and grant privileges.
<databaseUser> The username for the Cloudera Manager Server database to create or use.
<password> The password for the <databaseUser> to create or use. If you do not want the password visible on the screen or stored in the command history, do not specify the password, and you are prompted to enter it as follows:
Enter SCM password:
Table 2. Options
Option Description
-? or --help Display help.
--config-path The path to the Cloudera Manager Server configuration files. The default is /etc/cloudera-scm-server.
-f or --force The script does not stop if an error occurs.
-h or --host The IP address or hostname of the host where the database is installed. The default is to use localhost.
-p or --password The admin password for the database application. The default is no password. Do not put a space between -p and the password (for example, -phunter2). If you do not want the password visible on the screen or stored in the command history, use the -p option without specifying a password, and you are prompted to enter it as follows:
Enter database password:
-P or --port The port number to use to connect to the database. The default port is 3306 for MariaDB, 3306 for MySQL, 5432 for PostgreSQL, and 1521 for Oracle. This option is used for a remote connection only.
--scm-host The hostname where the Cloudera Manager Server is installed. If the Cloudera Manager Server and the database are installed on the same host, do not use this option or the -h option.
--scm-password-script A script to execute whose stdout provides the password for user SCM (for the database).
-u or --user The admin username for the database application. Do not put a space between -u and the username (for example, -uroot). If this option is supplied, the script creates a user and database for the Cloudera Manager Server. Otherwise, it uses the user and database you created previously.

Preparing the Cloudera Manager Server Database

  1. Run the scm_prepare_database.sh script on the Cloudera Manager Server host, using the database name, username, and password you created in Step 4: Install and Configure Databases for Cloudera Software:
    sudo /opt/cloudera/cm/schema/scm_prepare_database.sh <databaseType> <databaseName> <databaseUser>

    When prompted, enter the password.

  2. Remove the embedded PostgreSQL properties file if it exists:
    sudo rm /etc/cloudera-scm-server/db.mgmt.properties

Example 1: Running the script when MySQL is installed on another host

This example demonstrates how to run the script on the Cloudera Manager Server host (cm01.example.com) and connect to a remote MySQL host (db01.example.com) using the MySQL root user:

sudo /opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h db01.example.com -uroot -p --scm-host cm01.example.com scm scm scm
Enter database password:
JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing:  /usr/java/jdk1.8.0_141-cloudera/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/java/postgresql-connector-java.jar:/opt/cloudera/cm/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
[                          main] DbCommandExecutor              INFO  Successfully connected to database.
All done, your SCM database is configured correctly!

Example 2: Running the script to configure Oracle

sudo /opt/cloudera/cm/schema/scm_prepare_database.sh -h cm-oracle.example.com oracle orcl sample_user sample_pass
JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing:  /usr/java/jdk1.8.0_141-cloudera/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/java/postgresql-connector-java.jar:/opt/cloudera/cm/schema/../lib/*cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
[ main] DbCommandExecutor INFO Successfully connected to database.
All done, your SCM database is configured correctly!

Example 3: Running the script when MariaDB is co-located with the Cloudera Manager Server

This example assumes that you have already created the Cloudera Management Server database and database user, naming both scm:

sudo /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm scm
JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing:  /usr/java/jdk1.8.0_141-cloudera/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/java/postgresql-connector-java.jar:/opt/cloudera/cm/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
[                          main] DbCommandExecutor              INFO  Successfully connected to database.
All done, your SCM database is configured correctly!
Page generated March 7, 2018.