Syntax for scm_prepare_database.sh

Review the syntax of the scm_prepare_database.sh script before you run it to configure the Cloudera Manager database.

The syntax for the scm_prepare_database.sh script is as follows:

sudo /opt/cloudera/cm/schema/scm_prepare_database.sh <optional parameter> <databaseType> <databaseName> <databaseUser> <password>

The following tables describe the parameters and options for the scm_prepare_database.sh script:

Table 1. Parameters
Parameter (Required in bold) Description
<databaseType> One of the supported database types:
  • PostgreSQL: postgresql
  • MariaDB: mysql
  • MySQL: mysql
  • Oracle: oracle
<databaseName> The name of the Cloudera Manager Server database to use. For 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. The default database name provided in the Cloudera Manager configuration settings is scm, but you can also use any other database name such as cm_db or cmdb1.
<databaseUser> The username for the Cloudera Manager Server database to create or use. The default username provided in the Cloudera Manager configuration settings is scm_user, but you can also use any other database user such as cm_user or cm_db_user.
<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
-?|--help Display help.
--config-path The path to the Cloudera Manager Server configuration files. The default is /etc/cloudera-scm-server.
-f|--force If specified, the script does not stop if an error occurs.
-h|--host The IP address or hostname of the host where the database is installed. The default is to use localhost.
-p|--password The admin password for the database application. Use with the -u option. 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:
If you have already created the database, do not use this option.
-P|--port The port number to use to connect to the database. The default port is:
  • PostgreSQL: 5432
  • MariaDB: 3306
  • MySQL: 3306
  • Oracle: 1521
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|--user The admin username for the database application. Use with the -p option. 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. If you have already created the database, do not use this option.