Offline installation means that the cluster host cannot access the external network and cannot use yum to download the installation package from the external network.
MatrixDB 4 can be installed on Redhat 7, CentOS 7, and CentOS-compatible operating systems. This document describes the steps to quickly deploy MatrixDB 4 clusters on multiple CentOS 7 servers or virtual machines. Taking three nodes as an example, the main node is mdw and the two data nodes are sdw1 and sdw2 respectively. (Note: This tutorial is limited to 64-bit installation packages. If you need a 32-bit installation package, please prepare it yourself)
Please refer to [MatrixDB Installation and Deployment] for the teaching video of this course (https://www.bilibili.com/video/BV1Jf4y1b7Ef/)
Notes!
The MatrixDB installation environment must support at least Haswell and above Intel processor architecture, or Excavator and above AMD processor architecture.
The server installation process includes five steps: installation preparation, database RPM installation, Python dependency package installation, database initialization and post-installation settings.
The MatrixDB installer needs to rely on other resource packages and provides dependency packages by creating a local yum repository:
First download the offline warehouse compression package from the official website: matrixdb_local_repo.tar. On all nodes, unzip the installation package and run create_repo.sh through the root user:
tar xf matrixdb_local_repo.tar
cd matrixdb_local_repo
sh create_repo.sh
After successful execution, execute yum repolist
to view the yum repository and confirm that the installation is successful:
[root@localhost matrixdb_local_repo]# yum repolist
repo id repo name status
base/7/x86_64 CentOS-7 - Base 0
extras/7/x86_64 CentOS-7 - Extras 0
updates/7/x86_64 CentOS-7 - Updates 0
ymatrix ymatrix 0
repolist: 95
I saw that ymatrix has taken effect.
Turn off the firewall:
systemctl stop firewalld.service
systemctl disable firewalld.service
Turn off SELinux, edit /etc/selinux/config, and set the value of SELINUX to disabled:
sed s/^SELINUX=.*$/SELINUX=disabled/ -i /etc/selinux/config
setenforce 0
Make sure that there are persistent host names on all nodes. If they do not exist, please use the following command to set the host name. For example, you can set it in the master node like this:
hostnamectl set-hostname mdw
The two child nodes also set corresponding host names:
hostnamectl set-hostname sdw1
hostnamectl set-hostname sdw2
Ensure that all nodes in the cluster can access each other through hostname and IP. Add a record in /etc/hosts and map the host name to a local network card address. For example, the /etc/hosts of the three nodes contain something like this:
192.168.100.10 mdw
192.168.100.11 sdw1
192.168.100.12 sdw2
On all nodes, use the root user to execute the following yum command to install the database RPM package and specify the local repository. The system dependency library will be installed automatically. By default, it will be installed in the /usr/local/matrixdb directory:
yum install --disablerepo=* --enablerepo=ymatrix matrixdb-4.0.0-1.el7.x86_64.rpm
Note: During the actual installation process, please replace the file name with the latest downloaded rpm package name
After the installation is successful, the supervisord, cylinder, and mxui processes will be automatically started. These background processes are used to provide graphical operation interfaces, manage and control clusters, etc.
Download Python offline dependency package from the official website: pip.dep.tar
On all nodes, use the root user to execute the following command to install the python package that MatrixDB depends on. Note that source greenplum_path.sh must be executed so that the correct version of the dependency package can be installed:
source /usr/local/matrixdb/greenplum_path.sh
yum install --disablerepo=* --enablerepo=ymatrix python3-devel
tar xf pip.dep.tar
pip3 install pip.dep/*.whl
The graphical deployment provided by MatrixDB is still used here. Remote graphical deployment requires server ports 8240 and 4617 to access. After the installation is complete, these ports of all nodes will be opened by default.
Use your browser to access the following graphical installation wizard URL, which is the IP of the mdw server:
http://<IP>:8240/
On the first page of the installation wizard, you need to fill in the superuser password, which can be found in /etc/matrixdb/auth.conf
:
On the second page, select "Add multiple nodes and initialize the database cluster" and click Next:
Next, start the five-step operation of multi-machine deployment.
The first step is to add a node, enter the IP address, host name or FQDN of the node in the text box and click "Add Node":
After adding sdw1 and sdw2, click "Next"
At this time, the interconnection test between the hosts will be carried out to ensure that the network between the hosts is connected.
The second step is to configure the database and select the database directory storage path and number of segments. The system automatically recommends the largest space of disks and the number of segments matching the system resources, which can be adjusted according to the specific usage scenario. "Enable automatic data mirroring" determines whether the cluster data node contains backup images. It is recommended to check it in the production environment so that the cluster is highly available. After confirming, click "Next":
Step 3: Set the password. MatrixDB will create an mxadmin database administrator account and serve as a super account. In this link, set the password of the mxadmin account and click "Next" (the password of the database account is set here, not the password of the operating system account). In addition, there is another option that is "Allow remote connection to the database", which is checked by default:
Step 4: Confirm the deployment. This step will list the configuration parameters for the previous operation. After confirming that it is correct, click "Execute deployment":
Then, the system will automatically deploy the cluster and list the detailed steps and execution progress.
After all the steps are successfully executed, the deployment is completed. Click "Done":
At this time, you can see the basic methods of managing the database and how to set up allowing remote connections. To confirm that the database cluster is successfully deployed and accessible, you can click "Test Connection":
When you see a prompt for a successful connection, it means that the cluster can receive user requests normally:
MatrixDB default installation supports remote connection. If "Allow remote connection to database" is not checked during the installation process, please manually modify the $MASTER_DATA_DIRECTORY/pg_hba.conf file to add a line like this, indicating that users from any IP who access all databases are allowed to connect through password authentication. The IP range or database name can be limited according to actual needs to be used to reduce security risks:
host all all 0.0.0.0/0 md5
After completing these modifications, you need to execute the following command to reload the new settings of pg_hba.conf in the database:
gpstop -u
MatrixDB start, stop, restart and status viewing can be completed separately through the following commands. More command parameters can be viewed through --help:
gpstart -a
gpstop -af
gpstop -arf
gpstate