Damon database command line installation and initialization examples are introduced in detail
1. Environmental description
Virtual machine and version: VMware ® Workstation 16 Pro
Operating system and version: RedHat 7 one
Database and version: DM8
Operating system installation options: minimize installation
DM official website download address: https://www.dameng.com/ucenter/docs.html
Reference: official installation documentation
2. Operating system inspection
Before installing DM, you need to check the relevant information of the current operating system and confirm that the DM installation program matches the current operating system to ensure that DM can be installed and run correctly.
[root@localhost ~]# #Check system bits [root@localhost ~]# getconf LONG_BIT 64 [root@localhost ~]# #Query operating system release information [root@localhost ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.1 (Maipo) [root@localhost ~]# #Query system information [root@localhost ~]# cat /etc/issue \S Kernel \r on an \m [root@localhost ~]# #Query system name [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Thu Jan 29 18:37:38 EST 2015 x86_64 x86_64 x86_64 GNU/Linux
3. Create installation users and user groups
In order to reduce the impact on the operating system, DM should not be installed and run as root system user. You can create a dedicated system user for DM before installation.
[root@localhost ~]# #Create installation user group dinstall [root@localhost ~]# groupadd -g 12349 dinstall [root@localhost ~]# #Create and install user dmdba [root@localhost ~]# useradd -u 12345 -g dinstall -m -d /home/dmdba -s /bin/bash dmdba [root@localhost ~]# #Update the password of the installation user dmdba [root@localhost ~]# echo 'dameng' | passwd --stdin dmdba Change user dmdba Your password. passwd: All authentication tokens have been successfully updated.
4. Check the operating system limits
Parameter usage restrictions:
1.data seg size
It is recommended that the user set it to more than 1048576 (i.e. 1GB) or unlimited. If this parameter is too small, it will lead to
Failed to start the database.
2. file size
It is recommended that the user set it to unlimited. If this parameter is too small, the database installation or initialization will fail.
3. open files
It is recommended that users set it above 65536 or unlimited.
4.virtual memory
It is recommended that the user set it to more than 1048576 (i.e. 1GB) or unlimited. If this parameter is too small, the database startup will fail.
It can be seen that except for open files, other parameters are unlimited.
Modify the value of open files
[root@localhost ~]# vi /etc/security/limits.conf
Add two lines of configuration at the end of the file
* soft nofile 65537 # *On behalf of all users * hard nofile 65537
Restart the operating system and the configuration file takes effect
[root@localhost ~]# reboot
After restart, check the system limit again to see if the modification is successful
You can see that the value of open files has been modified
5. Check the system memory and storage space
5.1 check system memory
In order to ensure the correct installation and operation of DM, try to ensure that the operating system has at least 1GB of available memory (RAM).
[root@localhost ~]# #Gets the total memory size [root@localhost ~]# grep MemTotal /proc/meminfo MemTotal: 1003184 kB [root@localhost ~]# #Get swap partition size [root@localhost ~]# grep SwapTotal /proc/meminfo SwapTotal: 2097148 kB [root@localhost ~]# #Get memory usage details [root@localhost ~]# free total used free shared buff/cache available Mem: 1003184 127940 726120 6780 149124 721488 Swap: 2097148 0 2097148 [root@localhost ~]#
5.2 checking storage space
- The complete installation of DM requires 1GB of storage space. Users need to plan the installation directory in advance and reserve enough storage space.
- The DM installer will generate temporary files during installation. The temporary files need 1GB of storage space. The temporary file directory is / tmp by default.
[root@localhost ~]# df -hT file system type Capacity used available used% Mount point /dev/mapper/rhel-root xfs 18G 806M 17G 5% / devtmpfs devtmpfs 481M 0 481M 0% /dev tmpfs tmpfs 490M 0 490M 0% /dev/shm tmpfs tmpfs 490M 6.7M 484M 2% /run tmpfs tmpfs 490M 0 490M 0% /sys/fs/cgroup /dev/sda1 xfs 497M 120M 378M 25% /boot [root@localhost ~]# [root@localhost ~]# df -h /tmp file system Capacity used available used% Mount point /dev/mapper/rhel-root 18G 806M 17G 5% /
In the test environment, most of the space is mounted under /.
Pay attention to the storage space planning for the installation of the generation environment.
6. Upload the DM8 installation image file
Upload the image file through the file transfer tool
Create the installation directory and modify the user
[root@localhost ~]# #Create database installation directory [root@localhost ~]# mkdir /dm [root@localhost ~]# #Modify / dm user and user group [root@localhost ~]# chown -R dmdba:dinstall /dm
Mount image
[root@localhost ~]# #Create installation image file mount directory [root@localhost ~]# mkdir /dmdata [root@localhost ~]# #Mount image file [root@localhost ~]# mount dm8_20200907_x86_rh7_64_ent_8.1.1.126.iso /dmdata/ mount: /dev/loop0 Write protected, will mount as read-only
View the image mount directory / dmdata
7. Start installation
Install using the installation user dmdba.
Note: you cannot switch to the dmdba user through the su - command, otherwise the installer will fail to start. You should open a new shell and log in through the dmdba user.
Enter / dmdata
Execute the following command:
[dmdba@localhost ~]$ cd /dmdata/ [dmdba@localhost dmdata]$ ./DMInstall.bin -i
Step by step introduction to the installation process
Step 1: select the installation language
Select the language in the installation process, and press enter in Chinese by default.
Step 2: verify the key file
The user can choose whether to enter the Key file path. If not, enter the next step of installation. Enter the path of the Key file, and the installer will display the details of the Key file. If it is a legal Key file and is within the validity period, the user can continue to install.
Step 3: set time zone
Enter y enter
Step 4: set the time zone
The default 21 is Chinese standard time. Press enter directly
Step 5: select the installation type
Select the installation type according to the situation. Here, select Default direct enter
Step 6: select the installation directory
Select the installation directory and enter the / dm directory you created earlier
Installation directory confirmation
Step 7: installation summary
Enter y to start the installation
Step 8: database installation completed
Step 9: create a database service
The service cannot be created because the database installation service is not a root user. Execute the following command as root:
[root@localhost ~]# /dm/script/root/root_installer.sh
8. Initialize the database
Initialize the database through the tool dminit. The directory is in / dm/bin/
[dmdba@localhost bin]$ ./dminit path=/dm/data/ db_name=DMOA instance_name=DMOA port_num=5236
Initialize the database. The installation path is / dm/data, the database name is DMOA, the instance name is DMOA, and the port number is 5236. The rest remain the default (you can view the help for the default value).
Help allows you to print dminit help information
[dmdba@localhost bin]$ ./dminit help
keyword | Description (default) |
---|---|
INI_FILE | Initialization file DM Ini storage path |
PATH | Path of initial database storage |
CTL_PATH | Control file path |
LOG_PATH | log file path |
EXTENT_SIZE | Cluster size used by data file (16), optional values: 16, 32, 64, unit: page |
PAGE_SIZE | Data page size (8), optional values: 4, 8, 16, 32, unit: K |
LOG_SIZE | Log file size (256), unit: m, range: 64M ~ 2G |
CASE_SENSITIVE | Size sensitive (Y), optional values: Y/N, 1 / 0 |
CHARSET/UNICODE_FLAG | Character set (0), optional values: 0[GB18030], 1[UTF-8], 2[EUC-KR] |
SEC_PRIV_MODE | Permission management mode (0), optional values: 0 [transaction], 1[BMJ], 2[EVAL] |
LENGTH_IN_CHAR | Whether the length of VARCHAR type is in characters (N); optional values: Y/N, 1 / 0 |
SYSDBA_PWD | Set SYSDBA password (SYSDBA) |
SYSAUDITOR_PWD | Set SYSAUDITOR password (SYSAUDITOR) |
DB_NAME | Database name (DAMENG) |
INSTANCE_NAME | Instance name (DMSERVER) |
PORT_NUM | Listening port number (5236) |
BUFFER | System cache size (100), in M |
TIME_ZONE | Set time zone (+ 08:00) |
PAGE_CHECK | Page check mode (0), optional values: 0 / 1 / 2 |
EXTERNAL_CIPHER_NAME | Set default encryption algorithm |
EXTERNAL_HASH_NAME | Set default HASH algorithm |
EXTERNAL_CRYPTO_NAME | Set root key encryption engine |
RLOG_ENC_FLAG | Set whether the log file is encrypted (N). Optional values: Y/N, 1 / 0 |
USBKEY_PIN | Set USBKEY PIN |
PAGE_ENC_SLICE_SIZE | Set the page encryption slice size. Optional values: 512, 4096, unit: Byte |
ENCRYPT_NAME | Set full database encryption algorithm |
BLANK_PAD_MODE | Set space filling mode (0), optional values: 0 / 1 |
SYSTEM_MIRROR_PATH | SYSTEM data file image path |
MAIN_MIRROR_PATH | MAIN data file image |
ROLL_MIRROR_PATH | Rollback file image path |
MAL_FLAG | Set DM during initialization Mal in ini_ INI(0) |
ARCH_FLAG | Set DM during initialization Arch in ini_ INI(0) |
MPP_FLAG | Set DM when initializing libraries in the Mpp system Mpp in ini_ ini(0) |
CONTROL | Initialize the configuration file (see the system administrator's Manual for the format of the configuration file) |
AUTO_OVERWRITE | Overwrite all files with the same name (0) 0: do not overwrite 1: partial overwrite 2: full overwrite |
USE_NEW_HASH | Whether to use the improved character type HASH algorithm (1) |
DCP_MODE | Is it DCP proxy mode (0) |
DCP_PORT_NUM | Management port in DCP proxy mode |
ELOG_PATH | Specifies the path of the log file generated during initialization |
AP_PORT_NUM | Listening port for AP cooperative work in ECS mode |
DFS_FLAG | Set DM during initialization DFS in ini_ INI(0) |
DFS_PATH | Specifies the default path of the data file when dfs is enabled |
DFS_HOST | Specify the service address (localhost) to connect to the Distributed System DFS |
DFS_PORT | Specify the service port number (3332) to connect to the Distributed System DFS |
DFS_COPY_NUM | Specify the number of copies of the distributed system (3) |
DFS_DB_NAME | Specify the database name in the distributed system (the default is consistent with DB_NAME) |
SHARE_FLAG | Specify the shared properties of the database in the distributed system (0) |
REGION_MODE | Specify the block policy (0) of the system tablespace data file of the database in the distributed system 0: micro region policy 1: macro region policy |
HUGE_WITH_DELTA | Only creation of transactional HUGE table (1) is supported 1: Yes 0: no |
RLOG_GEN_FOR_HUGE | Generate HUGE table REDO log (0) 1: Yes 0: no |
PSEG_MGR_FLAG | Use management segment only to record transaction information (0) 1: Yes 0: no |
HELP | print the help information |
9. Registration services
Create a background service for the newly initialized database
It needs to be created as root
[root@localhost ~]# #Enter the / dm/script/root / directory [root@localhost ~]# cd /dm/script/root/ [root@localhost root]# #Create dmserver service [root@localhost root]# ./dm_service_installer.sh -t dmserver -dm_ini /dm/data/DMOA/dm.ini -p DM ln -s '/usr/lib/systemd/system/DmServiceDM.service' '/etc/systemd/system/multi-user.target.wants/DmServiceDM.service' Create service(DmServiceDM)complete [root@localhost root]# #Set to start automatically [root@localhost root]# systemctl enable DmServiceDM [root@localhost root]# #Start service [root@localhost root]# systemctl start DmServiceDM [root@localhost root]#
Yes/ dm_service_installer.sh -h print help
[root@localhost root]# ./dm_service_installer.sh -help
keyword | explain |
---|---|
-t | Service types, including dmimon, DMAP, dmserver, dmwatcher, dmmonitor, dmcss, dmcssm, dmsmsvr, dmdcs, dmdrs, dmdras, and dmdss |
-p | Service name suffix, invalid DMAP service type for dmimon |
-dm_ini | dm.ini file path |
-watcher_ini | dmwatcher.ini file path |
-monitor_ini | dmmonitor.ini file path |
-dcr_ini | dmdcr.ini file path |
-cssm_ini | dmcssm.ini file path |
-dss_ini | dss.ini file path |
-drs_ini | drs.ini file path |
-dras_ini | dras.ini file path |
-dcs_ini | dcs.ini file path |
-dfs_ini | dfs.ini file path |
-dmap_ini | dmap.ini file path |
-server | Server information (IP:PORT) |
-auto | Set whether the service starts automatically. The value is true or false. The default value is true |
-m | Set the server startup mode open or mount. It only takes effect for the dmserver service type. Optional |
-y | Set dependent service. This option is only effective for dmserver and dmamsvr services in systemd service environment |
-s | If the service script path is set, other parameter options except - y are ignored |
-h | help |
10. Log in to the database
Log in to the database through the disql tool
[dmdba@localhost bin]$ ./disql SYSDBA/SYSDBA@LOCALHOST:5236
Format: account / password @ network address: port number
Account: SYSDBA administrator account
Password: the initialization database can be specified. I don't know the default SYSDBA
Port number: initializes the port specified by the database_ NUM
Log in to the database, create a table test1, add a new piece of data, and query the results.
This completes the command line installation and initialization of DM database