2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-04 12:30:10 +00:00

Update the database documentation for mysql and postgres

This commit is contained in:
Victor Hu 2015-08-11 14:33:59 -04:00
parent cf2da529ee
commit 477ad8bf6b
6 changed files with 196 additions and 4 deletions

View File

@ -1,2 +1,24 @@
Configure MySQL
===============
Configure MySQL/MariaDB
=======================
Migrate xCAT to use MySQL/MariaDB
---------------------------------
The following utility is provided to migrate an existing xCAT database from SQLite to MySQL/MariaDB. ::
mysqlsetup -i
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 /path/to/file1
**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>`_
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

View File

@ -1,2 +1,85 @@
Install MySQL
=============
Install MySQL/MariaDB
=====================
The MySQL database is supported by xCAT since xCAT 2.1. MariaDB is a fork of the MySQL project which was released around 2009 and is a drop-in replacement for MySQL. MariaDB support within xCAT started in version 2.8.5 and is currently fully supported moving forward.
+------------+------------+------------+
| Database | MySQL | MariaDB |
+============+============+============+
| xCAT 2.1+ | Yes | No |
+------------+------------+------------+
| xCAT 2.8.5 | Yes | RHEL 7 |
+------------+------------+------------+
| xCAT 2.9 | Yes | SLES 12 |
+------------+------------+------------+
| xCAT 2.10+ | Yes | Yes |
+------------+------------+------------+
MySQL/MariaDB packages are shipped as part of most Linux Distributions.
Redhat Enterprise Linux
-----------------------
* MySQL - Using ``yum``, ensure that the following packages are installed on the management node: ::
perl-DBD-MySQL*
mysql-server-5.*
mysql-5.*
mysql-devel-5.*
mysql-bench-5.*
mysql-connector-odbc-*
* MariaDB - Using ``yum``, ensure that the following packages are installed on the management node: ::
mariadb-devel-5.*
mariadb-libs-5.*
mariadb-server-5.*
mariadb-bench-5.*
mariadb-5.*
perl-DBD-MySQL*
mysql-connector-odbc-*
unixODBC*
Suse Linux Enterprise Server
----------------------------
* MySQL - Using ``yum``, ensure that the following packages are installed on the management node: ::
mysql-client-5*
libmysqlclient_r15*
libqt4-sql-mysql-4*
libmysqlclient15-5*
perl-DBD-mysql-4*
mysql-5*
* MariaDB - Using ``yum``, ensure that the following packages are installed on the management node: ::
mariadb-client-10.*
mariadb-10.*
mariadb-errormessages-10.*
libqt4-sql-mysql-*
libmysqlclient18-*
perl-DBD-mysql-*
Debian/Ubuntu
-------------
* MySQL - Using ``apt-get``, ensure that the following packages are installed on the management node: ::
mysql-server
mysql-common
libdbd-mysql-perl
libmysqlclient18
mysql-client-5*
mysql-client-core-5*
mysql-server-5*
mysql-server-core-5*
* MariaDB - Using ``apt-get``, ensure that the following packages are installed on the management node: ::
libmariadbclient18
mariadb-client
mariadb-common
mariadb-server

View File

@ -0,0 +1,2 @@
Removing ``xcatdb`` from MySQL/MariaDB
======================================

View File

@ -0,0 +1,2 @@
Using MySQL/MariaDB
===================

View File

@ -0,0 +1,44 @@
Removing ``xcatdb`` from PostgreSQL
===================================
To remove ``xcatdb`` completely from the PostgreSQL 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 postgres, 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 PostgreSQL: ::
su - postgres
drop the xcatdb: ::
dropdb xcatdb
remove the xcatadm database owner : ::
dropuser xcatadm
clean up the postgresql files (necessary if you want to re-create the database): ::
cd /var/lib/pgsql/data
rm -rf *
#. Move, or remove, the ``/etc/xcat/cfglog`` file as it points xCAT to PostgreSQL. (without this file, xCAT defaults to SQLite): ::
mv /etc/xcat/cfgloc /etc/xcat/cfglog.postgres
#. Restore the PostgreSQL database into SQLite: ::
XCATBYPASS=1 restorexCATdb -p ~/xcat-dbback
#. Restart ``xcatd``: ::
service xcatd start

View File

@ -0,0 +1,39 @@
Using PostgreSQL
================
Refer to `<http://www.postgresql.org/>`_ for the latest documentation.
Using ``psql``, connect to the xcat database: ::
su - postgres
psql -h <hostname> -U xcatadm -d xcatdb (default pw: cluster)
list the xCAT tables: ::
xcatdb=> \dt
show the entries in the nodelist table: ::
xcatdb=> select * from nodelist;
quit postgres: ::
xcatdb=> \q
Useful Commands
---------------
Show the SQL create statement for a table: ::
/usr/bin/pg_dump_xcatdb -U xcatadm -t <table_name>
# example, for prescripts table:
/usr/bin/pg_dump xcatdb -U xcatadm -t prescripts
List all databases in postgres: ::
su - postgres
psql -l