This document describes the steps to quickly deploy MatrixDB on *** single node.
Notes!
To deploy a multi-node cluster, click MatrixDB 4 Cluster Deployment, MatrixDB 4 Cluster Deployment (Offline).
MatrixDB supports multiple operating systems such as Redhat, CentOS, Ubuntu, Zhongbiao Kirin, Galaxy Kirin, etc. The list is as follows:
Operating System | Supported CPU Architecture |
---|---|
CentOS 7 | x86_64 |
CentOS 8 | x86_64 |
Red Hat 7 | x86_64 |
Ubuntu 20.04 | x86_64 |
Winning Kirin V7 | x86_64 |
Winning Kirin V7 | ARM 64 |
Galaxy Kirin V10 | ARM 64 |
Galaxy Kirin V10 | Feiteng Edition |
Galaxy Kirin V10 | Kunpeng Version |
Notes!
Please refer to [MatrixDB Installation and Deployment] (https://www.bilibili.com/video/BV1Jf4y1b7Ef/). If the host cannot connect to the external network, please refer to [MatrixDB 4 Offline Cluster Deployment] (/doc/4.6/install/mx4_cluster_offline).
Before installation, please Download MatrixDB installation file.
The server installation process includes two steps: installation preparation and database deployment. The optional post-installation settings and basic database management commands are also discussed later.
All preparation operations need to be performed under the root user.
Copy the RPM package from local to the remote server.
~ scp <local path> <username>@<server IP address>: <server path>
Notes!
This step begins, all of the following operations need to be performed under the root user or with sudo permissions.
MatrixDB requires Python 3.6. Please use the following command to install and set Python 3.6 as the default version:
$ sudo yum install centos-release-scl
$ sudo yum install rh-python36
$ sudo scl enable rh-python36 bash
Turn off the firewall:
$ sudo systemctl stop firewalld.service
$ sudo systemctl disable firewalld.service
Turn off SELINUX, edit /etc/selinux/config
, and set the value of SELINUX to disabled
:
$ sudo sed s/^SELINUX=.*$/SELINUX=disabled/ -i /etc/selinux/config
$ sudo setenforce 0
Make sure there is a persistent host name on the installation node. If it does not exist, please use the following command to set the host name, set to mdw
in the example:
$ sudo hostnamectl set-hostname mdw
Modify the /etc/hosts
file:
$ sudo vim /etc/hosts
Map the host name to a local network card address. After the modification is completed, click the ESC key and enter :wq
to save and exit
192.168.100.10 mdw
Notes!
Do not add the aboveentry repeatedly in /etc/hosts
, otherwise an error "Inter-host network connection test failed" will appear when initializing the graphic interface.
When using the root user or sudo permissions to execute the following yum command to install the database RPM package, the system dependency library will be automatically installed together. By default, it will be installed in the /usr/local/matrixdb
directory:
$ sudo yum install matrixdb-4.8.0.enterprise-1.el7.x86_64.rpm
Notes!
During the actual installation process, please replace the file name with the latest downloaded RPM package name.
After the installation is successful, the supervisor and MXUI processes will be automatically started. These background processes are used to provide graphic operation interfaces and process management services.
If you have the requirement to configure ports, manually create the /etc/matrixdb/defaults.conf
file after installing the RPM package to configure. This operation is only performed on the master node (Master). Examples are as follows:
$ vim /etc/matrixdb/defaults.conf
Add the following content and modify the port number as needed.
MasterPortBase = 5438
StandbyPortBase = 5439
PrimaryPortBase = 6500
MirrorPortBase = 7500
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 gcc python3-devel
$ pip3 install --upgrade setuptools
$ pip3 install argparse psutil pygresql pyyaml
MatrixDB provides a simple and easy-to-use database deployment method, including graphic deployment and command line deployment. It is recommended to use graphic deployment. Remote graphic deployment requires server ports 8240 and 4617 to be accessible. The graphic interface service is provided by the MXUI process.
Use your browser to access the following graphic installation wizard URL, which is the Master Server IP:
http://<IP>:8240/
On the first page of the installation wizard, you need to fill in the super user password and use the sudo more /etc/matrixdb/auth.conf
command to view:
The second page automatically selects "Initialize a single node database on the local machine", please click Next:
Next, start the five-step operation of stand-alone deployment.
The first step is to automatically collect system information. Please check the number of cores and memory size of the system and click Next:
The second step is to select the database directory storage path and the number of data nodes (Segments). The system automatically recommends the largest space disk and the number of segments matching the system resources. You can adjust it according to the specific usage scenario. After confirming, click Next:
Step 3: Set the password. MatrixDB creates an mxadmin database administrator account and serves 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: Start deploying the database. The page displays tasks for background operations, including system settings, creating users and directories, initializing databases, starting databases, and cleaning and optimization. After clicking "Execute Deployment", start the deployment operation and display the progress of task completion in real time:
Step 5, complete. After the deployment operation is completed, you can click the "Finish" button to display the test connection and some subsequent optional configurations, including allowing remote connections, installing a graphic client, etc. Click Test Connection to automatically test whether the connection can be successfully connected.
MatrixDB also provides a one-click stand-alone command line deployment. The command is as follows. After execution, the database can be automatically started and used immediately:
source /usr/local/matrixdb/greenplum_path.sh
sudo env "PATH=$PATH" mxsetup
SSH Log in to the server and switch to the MatrixDB Admin user mxadmin:
$ sudo su - mxadmin
MatrixDB default installation supports remote connections. 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
To facilitate remote connections, and to test whether the database is initialized normally, please execute the following command to set the password for the database administrator user mxadmin (please replace mxpass with your password):
$ psql -c "alter role mxadmin with password 'mxpass'" -h localhost -p 5432 mxdb
After completing these modifications, you need to execute the following command to reload the new settings of pg_hba.conf
:
$ gpstop -u
SSH Log in to the server and switch to the MatrixDB Admin user mxadmin:
$ sudo su - mxadmin
The start, stop, restart and status view of MatrixDB can be completed separately through the following commands. More command parameters can be viewed through --help
:
$ gpstart -a
$ gpstop -af
$ gpstop -arf
$ gpstate
MatrixDB can be installed on low-end devices, as follows:
Minimum configuration |
---|
1GHZ Dual-Core Processor |
2GB memory |
2GB disk space |
RAID 1 (mirror) |
If installed on a memory device below 2G, you can add swap according to the following commands before installation to ensure that the device has no less than 2G swap space.
Create and enable a 2G SWAP area:
sudo dd if=/dev/zero of=/opt/swapfile count=2048 bs=1MiB
sudo chmod 600 /opt/swapfile
sudo mkswap /opt/swapfile
sudo swapon /opt/swapfile
swapon -s
free -m
Edit /etc/fstab
Add the following line to persist the swap area:
/opt/swapfile swap swap sw 0 0
MatrixDB is compatible with PostgreSQL 12 protocol. Many of PostgreSQL 12's commercial and open source client tools can be used with MatrixDB, which makes it easy to remotely access MatrixDB from a laptop and other personal computers.
Taking the open source tool DBeaver as an example, select to download the corresponding operating system installation package at https://dbeaver.io/download/. After installation, when connecting to the MatrixDB database, select PostgreSQL as the database type. DBeaver will automatically detect whether there is a correct JDBC driver in your system, or prompt to download it.
MatrixD B's command line tool psql can also be used remotely on Windows or Mac systems. Mac users can directly use brew to install:
$ brew install libpq
$ brew link --force libpq ail
Windows users, please download and install it from here: https://www.postgresql.org/download/windows/
After psql is installed, you can connect to the MatrixDB server through -h
specified host name and -p
specified port. Other common parameters of psql are as follows:
psql -h [hostname or IP] -p [port] -U [username] -W -d [database name]
For example:
$ psql -h 127.0.0.1 -p 5432 -U mxadmin -W -d mxdb