2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

Merge pull request #403 from cxhong/NM

Add sections to complete the mysql/mariadb documentation
This commit is contained in:
Victor Hu 2015-11-23 16:13:31 -05:00
commit 7adb95b3a3
3 changed files with 125 additions and 3 deletions

View File

@ -11,9 +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. ::
TODO: Show an example here of file1
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 <https://sourceforge.net/p/xcat/wiki/Setting_Up_MySQL_as_the_xCAT_DB/#configure-mysql-manually>`_
@ -21,4 +27,25 @@ If you need to update the database at a later time to give access to your servic
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@<servicenode(s)> 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;

View File

@ -1,2 +1,43 @@
Removing ``xcatdb`` from MySQL/MariaDB
======================================
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 later: ::
XCATBYPASS=1 restorexCATdb -p ~/xcat-dbback
* Change to PostgreSQL, please following documentation: :doc:`/guides/admin-guides/large_clusters/databases/postgres_install`
* Change back to default xCAT database, 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

View File

@ -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/MariaDB commands
-----------------------------
Refer to `<https://www.mariadb.org/>`_ 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;