Dameng database installation and use

Linux Dameng database installation and use

1. Download

Go to the official website to download and get an iso file. For Ubuntu and Centos, the official package is the same. Unzip the iso file to get the DMInstall.bin installation file and the installation manual DM8 Install.pdf.

1. Installation

In order to reduce the impact on the system, officials do not recommend using root to install Dameng.

1. Create a new user dmdba

# 创建 安装用户组dinstall 和 安装用户dmdba
groupadd -g 12349 dinstall
useradd -u 12345 -g dinstall -m -d /home/dmdba -s /bin/bash dmdba
passwd dmdba

Restart the computer, log in as user dmdba, and continue with the following operations. (You cannot switch dmdba directly, you must log out first, preferably restart!)

2. Check temporary space/set temporary space

# 查看 临时文件存储空间(需要保证至少有1G的存储空间)
df -h /tmp
如果空间过小,安装时会提示/tmp空间不足导致安装失败。
此时,可以手动指定安装的临时目录,

DM_INSTALL_TMPDIR=/home/dmdba/tmpDM
export DM_INSTALL_TMPDIR

3. Set Damengjava environment variables

# 配置达梦java环境
vim /home/dmdba/.bashrc

plus

DM_JAVA_HOME=/usr/local/java/jdk1.8.0_361

4. Installation

Put the unzipped DMInstall.bin file you downloaded at the beginning in any directory.

chmod 755 ./DMInstall.bin
./DMInstall.bin -i

Just follow the prompts to choose:

  • Installation type: Typical installation
  • Installation path: default /home/dmdba/dmdbms
    After the installation is completed, you will be prompted请以root用户执行..., and then execute it as root!

5. Initialize DB

Switch back to dmdba user. implement:

cd /home/dmdba/dmdbms/
mkdir data
cd bin
./dminit # 或 ./dminit path=/home/dmdba/dmdbms/data
# 数据目录
input system dir: /home/dmdba/dmdbms/data
# 库名
input db name: dev
# 库端口号,默认5236
input port num: 25236
input page size(4, 8, 16, 32): 16
input extent size(16, 32, 64): 32
input sec priv mode(0, 1, 2): 0
input time zone(-12:59, +14:00): +8
# 字符串大小写敏感吗?(区分大小写吗?)
string case sensitive? ([Y]es, [N]o): y
# 字符编码格式
# which charset to use? (0[GB18030], 1[UTF-8], 2[EUC-KR]): 1
length in char? ([Y]es, [N]o): 0
# 数据库加密吗?
enable database encrypt? ([Y]es, [N]o): n
input slice size(0, 512, 4096): 512
page check mode? (0/1/2): 0
input elog path: /home/dmdba/dmdbms/log
# 只创建增量大表吗
only create huge table with delta? (0/1): 1
rlog generate for huge? (0/1): 0
pseg_mgr_flag (0/1): 0
auto_overwrite mode? (0/1/2): 0
CHARACTER type fixed storage ? ([Y]es/1, [N]o/0): 0
SQL log forbid? ([Y]es/1, [N]o/0): 0

...(省略)
create dm database success. 2023-....(省略)

6. Registration service

Switch to the root user and execute:

cd /home/dmdba/dmdbms/script/root
# -dm_ini指的是创建新库dev所在数据目录下的信息文件dm.ini
./dm_service_installer.sh -t dmserver -p DMSERVER -dm_ini /home/dmdba/dmdbms/data/dev/dm.ini

创建服务(DmServiceDMSERVER)完成

7. Start DB

# 法一(建议)、后台启动
nohup /home/dmdba/dmdbms/bin/dmserver /home/dmdba/dmdbms/data/dev/dm.ini &

# 法二(建议)、root启动
systemctl start DmServiceDMSERVER # 或 service DmServiceDMSERVER start

# 法三、前台方式启动(未注册数据库服务可采用此方式)
/home/dmdba/dmdbms/bin/dmserver /home/dmdba/dmdbms/data/dev/dm.ini # 或者也可以自定义其他存储路径,因为还未注册服务嘛

8. Link DB

Switch back to dmdba user.

1) Log in to Dameng SQL interactive terminal
cd /home/dmdba/dmdbms/bin
./disql SYSDBA/[email protected]:25236
2) Open Dameng’s own database management tool (with graphical interface)
cd /home/dmdba/dmdbms/tool
./manager

Enter relevant information to log in:
Host name (IP): 127.0.0.1
Port: 25236 (default 5236)
Username: Default SYSDBA
Password: Default SYSDBA

9. Convenient configuration

1) Dameng link address configuration

Revision /etc/dm_svc.conf Text, addition:

# 名字任意,端口号和前面一致
dmlocalhost=(127.0.0.1:25236)

can be used

cd /home/dmdba/dmdbms/bin
./disql SYSDBA/SYSDBA@dmlocalhost # 用自定义的名字 dmlocalhost 代替了 127.0.0.1:25236

Open the Dameng SQL interactive terminal.

2) Environment variable configuration
export DM_HOME=/home/dmdba/dmdbms
export PATH=$PATH:${DM_HOME}/bin:${DM_HOME}/tool

source .bashrcAfter , you can directly use commands such as disql, manager.

# 打开SQL终端
disql SYSDBA/SYSDBA@dmlocalhost
# 打开DBA
manager

Guess you like

Origin blog.csdn.net/Acegem/article/details/133353450