Skip to content

Commit 5c4cf11

Browse files
committed
docs: Update the documentation for the database installtion.
This adds more documentation about installing the MySQL database locally or on an external node. It also adds Ubuntu documentation.
1 parent 9f2bd07 commit 5c4cf11

5 files changed

Lines changed: 121 additions & 99 deletions

docs/en-US/management-server-install-db-external.xml

Lines changed: 55 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22,84 +22,95 @@
2222
under the License.
2323
-->
2424

25-
<section id="install-database-on-separate-node">
25+
<section id="management-server-install-db-external">
2626
<title>Install the Database on a Separate Node</title>
2727
<para>This section describes how to install MySQL on a standalone machine, separate from the Management Server.
2828
This technique is intended for a deployment that includes several Management Server nodes.
2929
If you have a single-node Management Server deployment, you will typically use the same node for MySQL.
30-
See <xref linkend="install-database-on-management-server-node"/>.
30+
See <xref linkend="management-server-install-db-local"/>.
3131
</para>
32+
<note>
33+
<para>The management server doesn't require a specific distribution for the MySQL node.
34+
You can use a distribution or Operating System of your choice.
35+
Using the same distribution as the management server is recommended, but not required.
36+
See <xref linkend="management-server-system-requirements"/>.
37+
</para>
38+
</note>
3239
<orderedlist>
33-
<listitem><para>If you already have a version of MySQL installed on the Management Server node, make one of the following choices, depending on what version of MySQL it is. The most recent version tested is 5.1.58.</para>
34-
<itemizedlist>
35-
<listitem><para>If you already have installed MySQL version 5.1.58 or later, skip to step 3.</para>
36-
</listitem>
37-
<listitem><para>If you have installed a version of MySQL earlier than 5.1.58, you can either skip to step 3 or uninstall MySQL and proceed to step 2 to install a more recent version.</para></listitem>
38-
</itemizedlist>
39-
<warning><para>It is important that you choose the right database version. Never downgrade a MySQL installation.</para></warning>
40-
</listitem>
41-
<listitem><para>Log in as root to your Database Node and run the following commands. If you are going to install a replica database, then log in to the master.</para>
42-
<programlisting>
43-
# yum install mysql-server
44-
# chkconfig --level 35 mysqld on
45-
</programlisting>
40+
<listitem>
41+
<para>Install MySQL from the package repository from your distribution:</para>
42+
<para condition="community">On RHEL or CentOS:</para>
43+
<programlisting language="Bash">yum install mysql-server</programlisting>
44+
<para condition="community">On Ubuntu:</para>
45+
<programlisting language="Bash">apt-get install mysql-server</programlisting>
4646
</listitem>
4747
<listitem><para>Edit the MySQL configuration (/etc/my.cnf or /etc/mysql/my.cnf, depending on your OS)
4848
and insert the following lines in the [mysqld] section. You can put these lines below the datadir
4949
line. The max_connections parameter should be set to 350 multiplied by the number of Management
5050
Servers you are deploying. This example assumes two Management Servers.</para>
51+
<note>
52+
<para>On Ubuntu you can also create a file /etc/mysql/conf.d/cloudstack.cnf and add these directives there. Don't forget to add [mysqld] on the first line of the file.</para>
53+
</note>
5154
<programlisting>
5255
innodb_rollback_on_timeout=1
5356
innodb_lock_wait_timeout=600
5457
max_connections=700
5558
log-bin=mysql-bin
5659
binlog-format = 'ROW'
60+
bind-address = 0.0.0.0
5761
</programlisting>
58-
<note><para>The binlog-format variable is supported in MySQL versions 5.1 and greater. It is not supported in MySQL 5.0. In some versions of MySQL, an underscore character is used in place of the hyphen in the variable name. For the exact syntax and spelling of each variable, consult the documentation for your version of MySQL.</para></note>
5962
</listitem>
60-
<listitem><para>Restart the MySQL service, then invoke MySQL as the root user.</para>
61-
<programlisting>
62-
# service mysqld restart
63-
# mysql -u root
64-
</programlisting>
63+
<listitem>
64+
<para>On RHEL/CentOS MySQL doesn't start after installation, start it manually.</para>
65+
<programlisting language="Bash">service mysqld start</programlisting>
6566
</listitem>
66-
<listitem><para>Best Practice: On RHEL and CentOS, MySQL does not set a root password by default. It is very strongly recommended that you set a root password as a security precaution. Run the following commands, and substitute your own desired root password.</para>
67-
<programlisting>mysql> SET PASSWORD = PASSWORD('password');</programlisting>
68-
<para>From now on, start MySQL with mysql -p so it will prompt you for the password.</para>
67+
<listitem>
68+
<warning>
69+
<para>On RHEL and CentOS, MySQL does not set a root password by default. It is very strongly recommended that you set a root password as a security precaution. Run the following commands, and substitute your own desired root password. This step is not required on Ubuntu as it asks for a root password during installation.</para>
70+
</warning>
71+
<para>Run this command to secure your installation. You can answer "Y" to all questions except to "Disallow root login remotely?". This is required to set up the databases.</para>
72+
<programlisting>mysql_secure_installation</programlisting>
6973
</listitem>
70-
<listitem><para>To grant access privileges to remote users, perform the following steps.</para>
74+
<listitem><para>If a firewall is present on the system, open TCP port 3306 so external MySQL connections can be established.</para>
7175
<orderedlist numeration="loweralpha">
72-
<listitem><para>Run the following commands from the mysql prompt:</para>
73-
<programlisting>
74-
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
75-
mysql> exit
76-
</programlisting>
77-
</listitem>
78-
<listitem><para>Restart the MySQL service.</para>
79-
<programlisting># service mysqld restart</programlisting>
76+
<listitem>
77+
<para>On RHEL/CentOS:</para>
78+
<orderedlist>
79+
<listitem>
80+
<para>Edit the /etc/sysconfig/iptables file and add the following line at the beginning of the INPUT chain.</para>
81+
<programlisting>-A INPUT -p tcp --dport 3306 -j ACCEPT</programlisting>
82+
</listitem>
83+
<listitem>
84+
<para>Now reload the iptables rules.</para>
85+
<programlisting language="Bash">service iptables restart</programlisting>
86+
</listitem>
87+
</orderedlist>
8088
</listitem>
81-
<listitem><para>Open the MySQL server port (3306) in the firewall to allow remote clients to connect.</para>
82-
<programlisting># iptables -I INPUT -p tcp --dport 3306 -j ACCEPT</programlisting>
83-
</listitem>
84-
<listitem><para>Edit the /etc/sysconfig/iptables file and add the following line at the beginning of the INPUT chain.</para>
85-
<programlisting> -A INPUT -p tcp --dport 3306 -j ACCEPT</programlisting>
89+
<listitem>
90+
<para>On Ubuntu:</para>
91+
<para>UFW is the default firewall on Ubuntu, open the port with this command:</para>
92+
<programlisting language="Bash">ufw allow mysql</programlisting>
8693
</listitem>
8794
</orderedlist>
8895
</listitem>
89-
<listitem><para>Set up the database. The following command creates the cloud user on the database.</para>
96+
<listitem>
97+
<para>Set up the database. The following command creates the cloud user on the database.</para>
98+
<note>
99+
<para>This command should be run on the first Management server node!</para>
100+
</note>
90101
<itemizedlist>
91102
<listitem><para>In dbpassword, specify the password to be assigned to the cloud user. You can choose to provide no password.</para></listitem>
92103
<listitem><para>In deploy-as, specify the username and password of the user deploying the database. In the following command, it is assumed the root user is deploying the database and creating the cloud user.</para></listitem>
93104
<listitem><para>(Optional) For encryption_type, use file or web to indicate the technique used to pass in the database encryption password. Default: file. See About Password and Key Encryption.</para></listitem>
94105
<listitem><para>(Optional) For management_server_key, substitute the default key that is used to encrypt confidential parameters in the &PRODUCT; properties file. Default: password. It is highly recommended that you replace this with a more secure value. See About Password and Key Encryption.</para></listitem>
95106
<listitem><para>(Optional) For database_key, substitute the default key that is used to encrypt confidential parameters in the &PRODUCT; database. Default: password. It is highly recommended that you replace this with a more secure value. See About Password and Key Encryption.</para></listitem>
96107
</itemizedlist>
97-
<programlisting># cloud-setup-databases cloud:&lt;dbpassword&gt;@localhost --deploy-as=root:&lt;password&gt; -e &lt;encryption_type&gt; -m &lt;management_server_key&gt; -k &lt;database_key&gt;</programlisting>
108+
<programlisting language="Bash">cloud-setup-databases cloud:&lt;dbpassword&gt;@&lt;ip address mysql server&gt; \
109+
--deploy-as=root:&lt;password&gt; \
110+
-e &lt;encryption_type&gt; \
111+
-m &lt;management_server_key&gt; \
112+
-k &lt;database_key&gt;</programlisting>
98113
<para>When this script is finished, you should see a message like “Successfully initialized the database.”</para>
99114
</listitem>
100-
<listitem><para>Now that the database is set up, you can finish configuring the OS for the Management Server. This command will set up iptables, sudoers, and start the Management Server.</para>
101-
<programlisting># cloud-setup-management</programlisting>
102-
<para>You should see the message “Management Server setup is done.”</para>
103-
</listitem>
104115
</orderedlist>
105116
</section>

0 commit comments

Comments
 (0)