Detailed introduction to command line installation and database initialization under Linux

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

  1. The complete installation of DM requires 1GB of storage space. Users need to plan the installation directory in advance and reserve enough storage space.
  2. 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
keywordDescription (default)
INI_FILEInitialization file DM Ini storage path
PATHPath of initial database storage
CTL_PATHControl file path
LOG_PATHlog file path
EXTENT_SIZECluster size used by data file (16), optional values: 16, 32, 64, unit: page
PAGE_SIZEData page size (8), optional values: 4, 8, 16, 32, unit: K
LOG_SIZELog file size (256), unit: m, range: 64M ~ 2G
CASE_SENSITIVESize sensitive (Y), optional values: Y/N, 1 / 0
CHARSET/UNICODE_FLAGCharacter set (0), optional values: 0[GB18030], 1[UTF-8], 2[EUC-KR]
SEC_PRIV_MODEPermission management mode (0), optional values: 0 [transaction], 1[BMJ], 2[EVAL]
LENGTH_IN_CHARWhether the length of VARCHAR type is in characters (N); optional values: Y/N, 1 / 0
SYSDBA_PWDSet SYSDBA password (SYSDBA)
SYSAUDITOR_PWDSet SYSAUDITOR password (SYSAUDITOR)
DB_NAMEDatabase name (DAMENG)
INSTANCE_NAMEInstance name (DMSERVER)
PORT_NUMListening port number (5236)
BUFFERSystem cache size (100), in M
TIME_ZONESet time zone (+ 08:00)
PAGE_CHECKPage check mode (0), optional values: 0 / 1 / 2
EXTERNAL_CIPHER_NAMESet default encryption algorithm
EXTERNAL_HASH_NAMESet default HASH algorithm
EXTERNAL_CRYPTO_NAMESet root key encryption engine
RLOG_ENC_FLAGSet whether the log file is encrypted (N). Optional values: Y/N, 1 / 0
USBKEY_PINSet USBKEY PIN
PAGE_ENC_SLICE_SIZESet the page encryption slice size. Optional values: 512, 4096, unit: Byte
ENCRYPT_NAMESet full database encryption algorithm
BLANK_PAD_MODESet space filling mode (0), optional values: 0 / 1
SYSTEM_MIRROR_PATHSYSTEM data file image path
MAIN_MIRROR_PATHMAIN data file image
ROLL_MIRROR_PATHRollback file image path
MAL_FLAGSet DM during initialization Mal in ini_ INI(0)
ARCH_FLAGSet DM during initialization Arch in ini_ INI(0)
MPP_FLAGSet DM when initializing libraries in the Mpp system Mpp in ini_ ini(0)
CONTROLInitialize the configuration file (see the system administrator's Manual for the format of the configuration file)
AUTO_OVERWRITEOverwrite all files with the same name (0) 0: do not overwrite 1: partial overwrite 2: full overwrite
USE_NEW_HASHWhether to use the improved character type HASH algorithm (1)
DCP_MODEIs it DCP proxy mode (0)
DCP_PORT_NUMManagement port in DCP proxy mode
ELOG_PATHSpecifies the path of the log file generated during initialization
AP_PORT_NUMListening port for AP cooperative work in ECS mode
DFS_FLAGSet DM during initialization DFS in ini_ INI(0)
DFS_PATHSpecifies the default path of the data file when dfs is enabled
DFS_HOSTSpecify the service address (localhost) to connect to the Distributed System DFS
DFS_PORTSpecify the service port number (3332) to connect to the Distributed System DFS
DFS_COPY_NUMSpecify the number of copies of the distributed system (3)
DFS_DB_NAMESpecify the database name in the distributed system (the default is consistent with DB_NAME)
SHARE_FLAGSpecify the shared properties of the database in the distributed system (0)
REGION_MODESpecify 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_DELTAOnly creation of transactional HUGE table (1) is supported 1: Yes 0: no
RLOG_GEN_FOR_HUGEGenerate HUGE table REDO log (0) 1: Yes 0: no
PSEG_MGR_FLAGUse management segment only to record transaction information (0) 1: Yes 0: no
HELPprint 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
keywordexplain
-tService types, including dmimon, DMAP, dmserver, dmwatcher, dmmonitor, dmcss, dmcssm, dmsmsvr, dmdcs, dmdrs, dmdras, and dmdss
-pService name suffix, invalid DMAP service type for dmimon
-dm_inidm.ini file path
-watcher_inidmwatcher.ini file path
-monitor_inidmmonitor.ini file path
-dcr_inidmdcr.ini file path
-cssm_inidmcssm.ini file path
-dss_inidss.ini file path
-drs_inidrs.ini file path
-dras_inidras.ini file path
-dcs_inidcs.ini file path
-dfs_inidfs.ini file path
-dmap_inidmap.ini file path
-serverServer information (IP:PORT)
-autoSet whether the service starts automatically. The value is true or false. The default value is true
-mSet the server startup mode open or mount. It only takes effect for the dmserver service type. Optional
-ySet dependent service. This option is only effective for dmserver and dmamsvr services in systemd service environment
-sIf the service script path is set, other parameter options except - y are ignored
-hhelp

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

Keywords: Database

Added by parms on Thu, 23 Dec 2021 22:39:49 +0200