From 35606b55423dfa955767c980978322383bc54153 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 12 Nov 2015 11:53:47 -0500 Subject: [PATCH 1/3] Add sections to complete the mysql/mariadb documentation --- .../databases/mysql_configure.rst | 4 +- .../large_clusters/databases/mysql_remove.rst | 37 +++++++++++++ .../large_clusters/databases/mysql_using.rst | 54 +++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst index f8134d8f5..5278a47b3 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst @@ -11,7 +11,9 @@ The following utility is provided to migrate an existing xCAT database from SQLi If you need to update the database at a later time to give access to your service nodes, you can use the ``mysqlsetup -u -f`` command. A file needs to be provided with all the hostnames and/or IP addresses of the servers that need to access the database on the Management node. Wildcards can be used. :: - TODO: Show an example here of file1 + cat /path/to/file1 + service1 + 10.1.1.1 mysqlsetup -u -f /path/to/file1 diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst index c8531a8c1..e7f5e2f9e 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst @@ -1,2 +1,39 @@ Removing ``xcatdb`` from MySQL/MariaDB ====================================== + +To remove ``xcatdb`` completely from the MySQL/MariaDB database: + +#. Run a backup of the database to save any information that is needed: :: + + mkdir -p ~/xcat-dbback + dumpxCATdb -p ~/xcat-dbback + +#. Stop the ``xcatd`` daemon on the management node. + **Note:** If you are using *xCAT Hierarchy (service nodes)* and removing ``xcatdb`` from MySQL/MariaDB, hierarchy will no longer work. You will need to configure another database which supports remote database access to continue using the hierarchy feature. :: + + service xcatd stop + +#. Remove the ``xatdb`` from MySQL/MariaDB: :: + + /usr/bin/mysql -u root -p + + drop the xcatdb: :: + + mysql> drop database xcatdb; + + remove the xcatadm database owner : :: + + mysql> drop user xcatadm; + +#. Move, or remove, the ``/etc/xcat/cfglog`` file as it points xCAT to MySQL/MariaDB. (without this file, xCAT defaults to SQLite): :: + + mv /etc/xcat/cfgloc /etc/xcat/cfglog.mysql + +#. Restore the MySQL/MariaDB database into SQLite: :: + + XCATBYPASS=1 restorexCATdb -p ~/xcat-dbback + +#. Restart ``xcatd``: :: + + service xcatd start + diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst index 7d80b15ed..75b498718 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst @@ -1,2 +1,56 @@ Using MySQL/MariaDB =================== + +Start/Stop MySQL/MariaDB service +-------------------------------- + +**[RHEL]** for mariadb: :: + + service mariadb start + service mariadb stop + +**[RHEL]** for mysql:: + + service mysqld start + service mysqld stop + +**[SLES]** and **[Ubuntu]**: :: + + service mysql start + service mysql stop + + +Basic mysql commands +-------------------------------------- + +Refer to ``_ for the latest documentation. + +Using ``mysql``, connect to the xcat database: :: + + mysql -u root -p + +list the hosts and users which managed by this xcat MN: :: + + MariaDB> SELECT host, user FROM mysql.user; + +list the databases: :: + + MariaDB> SHOW DATABASES; + +use the xcatdb: :: + + MariaDB> use xcatdb; + +list all the tables: :: + + MariaDB [xcatdb]> SHOW TABLES; + +show the entries in the nodelist table: :: + + MariaDB [xcatdb]> select * from nodelist; + +quit mysql: :: + + MariaDB [xcatdb]> quit; + + From 98a55f1ea4a73928ce5210059c0ce7b76125b34d Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 13 Nov 2015 14:11:33 -0500 Subject: [PATCH 2/3] Modify doc from victor's comments --- .../databases/mysql_configure.rst | 12 +++-- .../large_clusters/databases/mysql_remove.rst | 54 ++++++++++--------- .../large_clusters/databases/mysql_using.rst | 4 +- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst index 5278a47b3..ed0ff7271 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst @@ -11,11 +11,15 @@ The following utility is provided to migrate an existing xCAT database from SQLi If you need to update the database at a later time to give access to your service nodes, you can use the ``mysqlsetup -u -f`` command. A file needs to be provided with all the hostnames and/or IP addresses of the servers that need to access the database on the Management node. Wildcards can be used. :: - cat /path/to/file1 - service1 - 10.1.1.1 + mysqlsetup -u -f /tmp/servicenodes - mysqlsetup -u -f /path/to/file1 +where the /tmp/servicenodes contains a host per line: :: + + cat /tmp/servicenodes + node1 + 1.115.85.2 + 10.%.%.% + node2.cluster.net **While not recommended**, if you wish to manually migrate your xCAT database, see the following documentation: `Manually set up MySQL `_ diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst index e7f5e2f9e..73c5b07fe 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst @@ -1,39 +1,43 @@ Removing ``xcatdb`` from MySQL/MariaDB ====================================== -To remove ``xcatdb`` completely from the MySQL/MariaDB database: +For some reason, if you do not want to use MySQL/MariaDB to maintain ``xcatdb``, and like to switch to PostgreSQL or just default SQLite ( **Note:** SQLite does not support xCAT Hierarchy (has service nodes)), you can always to do that with the xCAT command. -#. Run a backup of the database to save any information that is needed: :: +* Run a backup of the database to save any information that is needed (optional): :: mkdir -p ~/xcat-dbback dumpxCATdb -p ~/xcat-dbback -#. Stop the ``xcatd`` daemon on the management node. - **Note:** If you are using *xCAT Hierarchy (service nodes)* and removing ``xcatdb`` from MySQL/MariaDB, hierarchy will no longer work. You will need to configure another database which supports remote database access to continue using the hierarchy feature. :: - - service xcatd stop - -#. Remove the ``xatdb`` from MySQL/MariaDB: :: - - /usr/bin/mysql -u root -p - - drop the xcatdb: :: - - mysql> drop database xcatdb; - - remove the xcatadm database owner : :: - - mysql> drop user xcatadm; - -#. Move, or remove, the ``/etc/xcat/cfglog`` file as it points xCAT to MySQL/MariaDB. (without this file, xCAT defaults to SQLite): :: - - mv /etc/xcat/cfgloc /etc/xcat/cfglog.mysql - -#. Restore the MySQL/MariaDB database into SQLite: :: + If you want to restore this database: :: XCATBYPASS=1 restorexCATdb -p ~/xcat-dbback -#. Restart ``xcatd``: :: +* Change to PostgrSQL, please follow link https://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/large_clusters/databases/postgres_install.html + + +* Change to default SQLite (**Note**: xCAT Hierarchy cluster will no longer work) + + #. Stop the ``xcatd`` daemon on the management node. :: + + service xcatd stop + + #. Remove the ``xatdb`` from MySQL/MariaDB (optional): :: + + /usr/bin/mysql -u root -p + + drop the xcatdb: :: + + mysql> drop database xcatdb; + + remove the xcatadm database owner : :: + + mysql> drop user xcatadm; + + #. Move, or remove, the ``/etc/xcat/cfglog`` file as it points xCAT to MySQL/MariaDB. (without this file, xCAT defaults to SQLite): :: + + rm /etc/xcat/cfgloc + + #. Restart ``xcatd``: :: service xcatd start diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst index 75b498718..430a7d609 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst @@ -20,8 +20,8 @@ Start/Stop MySQL/MariaDB service service mysql stop -Basic mysql commands --------------------------------------- +Basic MySQL/MariaDB commands +----------------------------- Refer to ``_ for the latest documentation. From 00a0dea6153bb0be7db99355037a6b06861cf818 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 16 Nov 2015 11:36:47 -0500 Subject: [PATCH 3/3] add access/revoke subsetion --- .../databases/mysql_configure.rst | 23 ++++++++++++++++++- .../large_clusters/databases/mysql_remove.rst | 8 +++---- .../large_clusters/databases/mysql_using.rst | 18 +++++++-------- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst index ed0ff7271..4b03f9b78 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_configure.rst @@ -27,4 +27,25 @@ where the /tmp/servicenodes contains a host per line: :: Granting/Revoking access to the database for Service Node Clients ----------------------------------------------------------------- -https://sourceforge.net/p/xcat/wiki/Setting_Up_MySQL_as_the_xCAT_DB/#granting-or-revoking-access-to-the-mysql-database-to-service-node-clients +* Log into the MySQL interactive program. :: + + /usr/bin/mysql -r root -p + +* Granting access to the xCAT database. Service Nodes are required for xCAT hierarchical support. Compute nodes may also need access that depends on which application is going to run. (xcat201 is xcatadmin's password for following examples) :: + + MariaDB > GRANT ALL on xcatdb.* TO xcatadmin@ IDENTIFIED BY 'xcat201'; + + Use the wildcards to do a GRANT ALL to every ipaddress or nodename that need to access the database. :: + + MariaDB > GRANT ALL on xcatdb.* TO xcatadmin@'%.cluster.net' IDENTIFIED BY 'xcat201'; + MariaDB > GRANT ALL on xcatdb.* TO xcatadmin@'8.113.33.%' IDENTIFIED BY 'xcat201'; + +* To revoke access, run the following: :: + + MariaDB > REVOKE ALL on xcatdb.* FROM xcatadmin@'8.113.33.%'; + +* To Verify the user table was populated. :: + + MariaDB > SELECT host, user FROM mysql.user; + + diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst index 73c5b07fe..f00fbad56 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_remove.rst @@ -1,21 +1,21 @@ Removing ``xcatdb`` from MySQL/MariaDB ====================================== -For some reason, if you do not want to use MySQL/MariaDB to maintain ``xcatdb``, and like to switch to PostgreSQL or just default SQLite ( **Note:** SQLite does not support xCAT Hierarchy (has service nodes)), you can always to do that with the xCAT command. +If you no longer want to use MySQL/MariaDB to maintain ``xcatdb``, and like to switch to PostgreSQL or just default SQLite ( **Note:** SQLite does not support xCAT Hierarchy (has service nodes)), use the following documentation as guide to remove ``xcatdb``. * Run a backup of the database to save any information that is needed (optional): :: mkdir -p ~/xcat-dbback dumpxCATdb -p ~/xcat-dbback - If you want to restore this database: :: + If you want to restore this database later: :: XCATBYPASS=1 restorexCATdb -p ~/xcat-dbback -* Change to PostgrSQL, please follow link https://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/large_clusters/databases/postgres_install.html +* Change to PostgreSQL, please following documentation: :doc:`/guides/admin-guides/large_clusters/databases/postgres_install` -* Change to default SQLite (**Note**: xCAT Hierarchy cluster will no longer work) +* Change back to default xCAT database, SQLite (**Note**: xCAT Hierarchy cluster will no longer work) #. Stop the ``xcatd`` daemon on the management node. :: diff --git a/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst b/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst index 430a7d609..899e90a8a 100644 --- a/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst +++ b/docs/source/guides/admin-guides/large_clusters/databases/mysql_using.rst @@ -4,12 +4,12 @@ Using MySQL/MariaDB Start/Stop MySQL/MariaDB service -------------------------------- -**[RHEL]** for mariadb: :: +**[RHEL]** for MariaDB: :: service mariadb start service mariadb stop -**[RHEL]** for mysql:: +**[RHEL]** for MySQL:: service mysqld start service mysqld stop @@ -25,31 +25,31 @@ Basic MySQL/MariaDB commands Refer to ``_ for the latest documentation. -Using ``mysql``, connect to the xcat database: :: +* Using ``mysql``, connect to the xcat database: :: mysql -u root -p -list the hosts and users which managed by this xcat MN: :: +* List the hosts and users which managed by this xcat MN: :: MariaDB> SELECT host, user FROM mysql.user; -list the databases: :: +* List the databases: :: MariaDB> SHOW DATABASES; -use the xcatdb: :: +* Use the xcatdb: :: MariaDB> use xcatdb; -list all the tables: :: +* List all the tables: :: MariaDB [xcatdb]> SHOW TABLES; -show the entries in the nodelist table: :: +* Show the entries in the nodelist table: :: MariaDB [xcatdb]> select * from nodelist; -quit mysql: :: +* Quit mysql: :: MariaDB [xcatdb]> quit;