Yashan数据库安装运行实操--崖山数据库

一、yashan 数据库&环境信息

1、操作系统版本:Centos 7 ,虚拟机硬件:6GB内存,5GB存储

1
2
3
[fang@localhost ~]$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

2、数据库版本:yashandb-personal-23.2.3.100-linux-x86_64.tar.gz

3、参考文案:
1.官方文档
2.摩天轮
3.需要升级SSL
4.VM虚拟机网卡ens33丢失

二 、创建安装用户

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
############################################################
## scripts: ysdb_user.sh
## purpose: 配置崖山数据库用户
############################################################
groupadd yashan
useradd -g yashan -s /bin/bash -c "yashan Owner" yashan
echo "yashan" | passwd --stdin yashan
chmod +w /etc/sudoers
echo "yashan ALL=(ALL)NOPASSWD:ALL" >> /etc/sudoers
chmod -w /etc/sudoers

三 、调整系统参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
############################################################
## scripts: ysdb_limits.sh
## purpose: 配置崖山数据库资源参数
##
############################################################
echo "
* soft nofile 1048576
* hard nofile 1048576
* soft nproc 1048576
* hard nproc 1048576
* soft rss unlimited
* hard rss unlimited
* soft stack 8192
* hard stack 8192
" >> /etc/security/limits.conf

四、安装踩坑–安装版本问题

1
2
3
4
安装成功:yashandb-personal-23.1.1.100-linux-x86_64.tar.gz 可以完成安装,并成功启动

安装失败:yashandb-personal-23.2.3.100-linux-x86_64.tar.gz 可以完成安装,无法部署,
报错信息:prohibited operation,please check if the IP and username are correct。检查无误。

五、执行安装过程

1、以yashan的账户登录,创建inst 目录

1
2
解压:  tar zxf yashandb-personal-23.2.3.100-linux-x86_64.tar.gz

2、在inst 目录执行生成部署文件

注意给/home/yashan/yasdb_data、/home/yashan/yasdb_home 授权

1
2
3
4
5
6
7
8
9
10

[yashan@localhost inst]$ sudo ./bin/yasboot package se gen --cluster yashandb -u yashan -p yashan --ip 192.168.230.135 --port 22 --install-path /home/yashan/yasdb_home --data-path /home/yashan/yasdb_data --begin-port 1688
hostid | group | node_type | node_name | listen_addr | replication_addr | data_path
------------------------------------------------------------------------------------------------------------------
host0001 | dbg1 | db | 1-1 | 192.168.230.135:1688 | 192.168.230.135:1689 | /home/yashan/yasdb_data
----------+-------+-----------+-----------+----------------------+----------------------+-------------------------

Generate config success


3、执行部署,注意 prog=100标识部署完成

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198

[yashan@localhost inst]$ sudo ./bin/yasboot cluster deploy -t yashandb.toml
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
task | 39bfc7e3b93423b6 | DeployYasdbCluster | - | yashandb | RUNNING | - | 0 | -
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | prog
------------------------------------------------------------------------------------------------
task | 39bfc7e3b93423b6 | DeployYasdbCluster | - | yashandb | SUCCESS | 0 | 100
------+------------------+--------------------+--------+----------+---------+-------------+-----
task completed, status: SUCCESS


如部署出现问题,可以清除,在重新部署

1
2
3
4
5
6
7
8
9
10
11
[yashan@localhost inst]$ sudo ./bin/yasboot cluster clean --cluster yashandb --purge
Are you sure you want to CLEAN cluster: [yashandb], AND ALL DATA WILL BE DELETED (-p/--purge is given)?
[yes/no]: yes
type | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------
task | da56493acbf07873 | CleanYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 1
------+------------------+-------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

4、配置环境变量

1
2
3
4
5
6
7
$ cd /home/yashan/yasdb_home/yashandb/23.1.1.100/conf
# 如~/.bashrc中已存在YashanDB相关的环境变量,将其清除

$ cat yashandb.bashrc >> ~/.bashrc
$ source ~/.bashrc


5、修改数据库初始密码文件

1
2
3
4
5
6
$ cd /home/yashan/yasdb_data/db-1-1/instance
$ mv yasdb.pwd yasdb1.pwd
$ yaspwd file=yasdb.pwd
Enter password for SYS:

注意:数据库密码如有@字符,会导致yasql链接不上

6、查看数据库实例

1
2
3
4
5
6
[yashan@localhost instance]$ yasboot cluster status -c yashandb
host_id | node_type | nodeid | pid
---------------------------------------
host0001 | db | 1-1:1 | 72746
----------+-----------+--------+-------

7、yasql连接接数据库并查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[yashan@localhost instance]$ yasql sys/fang!@#123
Connected to:
YashanDB Server Personal Edition Release 23.1.1.100 x86_64 - X86 64bit Linux


-- 查询数据库id
SQL> select database_id from v$database;

DATABASE_ID
---------------------
2226856082

1 row fetched.


-- 查询数据库实例状态
SQL> SELECT status FROM V$INSTANCE;

STATUS
-------------
OPEN

1 row fetched.

8、关闭/启动数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- 关机
[yashan@localhost instance]$ yasboot cluster stop -c yashandb
type | uuid | name | hostid | index | status | return_code | progress | cost
----------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
----------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
----------------------------------------------------------------------------------------------------------
task | c16eafa57641c31a | StopYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 2
------+------------------+------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

---开机
[yashan@localhost instance]$ yasboot cluster start -c yashandb
type | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------
task | a378db90e21e770d | StartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 3
------+------------------+-------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

-- 重启数据库--至open
[yashan@localhost instance]$ yasboot cluster restart -c yashandb
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
task | d9bc834c5978e824 | ReStartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 4
------+------------------+---------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
-- 重启数据库--至nomount
[yashan@localhost instance]$ yasboot cluster restart -c yashandb -m nomount

type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
task | d2bbaff1452b741e | ReStartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 5
------+------------------+---------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

-- 重启数据库--至mount
[yashan@localhost instance]$ yasboot cluster restart -c yashandb -m mount
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
task | 5651433b842f6395 | ReStartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 5
------+------------------+---------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS





六、开机启动问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

## 手动启动
$ cd /home/yashan/install
## 守护进程用于持续监控YashanDB的各进程状态
$ ./bin/yasboot monit start --cluster yashandb
## 启动yasom进程: 运维服务进程
$ yasboot process yasom start -c yashandb
## 启动yasagent进程: 无状态运维服务进程
$ yasboot process yasagent start -c yashandb
## 启动数据建库:yasdb为YashanDB的主进程,启动数据库实例后,系统中可监控到此进程。
$ yasboot cluster start -c yashandb

##注册开机自启动
$ sudo vim /etc/rc.local

$ su yashan -c '/data/yashan/yasdb_home/yashandb/23.1.100/ext/monit/monit -c /data/yashan/yasdb_home/yashandb/23.1.100/ext/monit/monitrc'

sudo chmod +x /etc/rc.d/rc.local

七、客户端无法连接数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
a、查看端口情况:lsof -i:1688
[root@localhost yasdb_data]# lsof -i:1688
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
yasdb 75868 yashan 16u IPv4 187542 0t0 TCP localhost.localdomain:nsjtp-data (LISTEN)

b、查看防火墙情况:
[root@localhost yasdb_data]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
c、添加防火墙端口
[root@localhost yasdb_data]# firewall-cmd --add-port=1688/tcp --permanent
success
[root@localhost yasdb_data]# firewall-cmd --reload
success

d、查看防火墙情况,注意端口已添加

[root@localhost yasdb_data]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client ssh
ports: 1688/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
e、使用telnet测试端口,测试通,则驱动可以链接

telnet 192.168.230.135 1688