原 YashanDB个人版安装
Tags: 原创安装部署国产数据库YashanDB崖山数据库
下载
https://download.yashandb.com/download
环境准备
下表为个人开发环境最小配置,请根据如下配置自行调整软硬件配置。
项目 | 描述 |
---|---|
操作系统 | CentOS 7.6,kylin V10 |
CPU | X86_64,ARM64 2C |
内存 | 4G |
硬盘 | 50G |
文件系统 | SSD |
网络 | 千兆以太网,支持TCP和UDP链接 |
安装
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 | docker rm -f lhryashandb docker run -itd --name lhryashandb -h lhryashandb \ -p 1688:1688 -p 33389:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --restart=always \ --privileged=true lhrbest/lhrcentos76:9.2 \ /usr/sbin/init docker exec -it lhryashandb bash wget https://linked.yashandb.com/resource/yashandb-personal-23.1.1.100-linux-x86_64.tar.gz useradd -d /home/yashan -m yashan echo "lhr"|passwd --stdin yashan groupadd YASDBA usermod -a -G YASDBA yashan cat >> /etc/security/limits.conf << "EOF" #add by yashandb * soft nofile 65536 * hard nofile 65536 * soft nproc 65536 * hard nproc 65536 * soft rss unlimited * hard rss unlimited * soft stack 8192 * hard stack 8192 EOF mkdir -p /yashandb/{install,data} tar -xvf /soft/yashandb-personal-23.1.1.100-linux-x86_64.tar.gz -C /yashandb/install chown -R yashan:yashan /yashandb chmod -R 755 /yashandb -- 生成参数文件:执行如下命令生成安装参数文件,ssh登录密码为创建yashan用户时指定的密码: su - yashan cd /yashandb/install/ ./bin/yasboot package se gen --cluster yashandb -u yashan -p lhr --ip 127.0.0.1 --port 22 \ --install-path /yashandb/install --data-path /yashandb/data \ --begin-port 1688 -- 安装 ./bin/yasboot package install -t /yashandb/install/hosts.toml -i yashandb-personal-23.1.0.100-linux-x86_64.tar.gz ./bin/yasboot cluster deploy -t /yashandb/install/yashandb.toml -- 环境变量 cd /yashandb/install/conf cat yashandb.bashrc >> ~/.bashrc source ~/.bashrc -- 修改sys密码 cd /yashandb/data/db-1-1/instance rm -rf yasdb.pwd yaspwd file=yasdb.pwd password=lhra@123 -- 查看YashanDB数据库状态 yasboot cluster status -c yashandb -- 登陆 yasql 'sys/"lhra@123"' yasql / as sysdba select open_mode from v$database; create user lhr identified by lhr; grant dba to lhr; alter user sys identified by lhr; -- 配置监听 远程登录 vi /yashandb/data/db-1-1/config/yasdb.ini LISTEN_ADDR=0.0.0.0:1688 |
数据库安装过程中将实例自动切换成OPEN阶段,并创建名为yashandb的数据库。
日志:
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 | [yashan@lhryashandb install]$ cd /yashandb/install/ [yashan@lhryashandb install]$ ./bin/yasboot package se gen --cluster yashandb -u yashan -p lhr --ip 127.0.0.1 --port 22 \ > --install-path /yashandb/install --data-path /yashandb/data \ > --begin-port 1688 hostid | group | node_type | node_name | listen_addr | replication_addr | data_path ----------------------------------------------------------------------------------------------- host0001 | dbg1 | db | 1-1 | 127.0.0.1:1688 | 127.0.0.1:1689 | /yashandb/data ----------+-------+-----------+-----------+----------------+------------------+---------------- Generate config success [yashan@lhryashandb install]$ [yashan@lhryashandb install]$ ll -lrt total 40 drwxr-xr-x 3 yashan yashan 21 Nov 9 18:16 plug-in -rwxr-xr-x 1 yashan yashan 14989 Nov 9 18:16 LICENSE drwxr-xr-x 3 yashan yashan 17 Nov 9 18:16 java -rwxr-xr-x 1 yashan yashan 11632 Nov 9 18:16 gitmoduleversion.dat drwxr-xr-x 2 yashan yashan 170 Nov 9 18:16 scripts drwxr-xr-x 2 yashan yashan 4096 Nov 9 18:16 lib drwxr-xr-x 2 yashan yashan 65 Nov 9 18:16 include drwxr-xr-x 5 yashan yashan 60 Nov 9 18:16 ext drwxr-xr-x 2 yashan yashan 152 Nov 9 18:16 conf drwxr-xr-x 6 yashan yashan 70 Nov 9 18:16 admin drwxrwxr-x 2 yashan yashan 25 Nov 13 15:43 om drwxr-xr-x 2 yashan yashan 227 Nov 13 15:43 bin -rw------- 1 yashan yashan 492 Nov 13 15:45 hosts.toml -rw------- 1 yashan yashan 660 Nov 13 15:45 yashandb.toml [yashan@lhryashandb install]$ pwd /yashandb/install [yashan@lhryashandb install]$ cat hosts.toml uuid = "655d609c10d65bf1ca46c7b6366f6e90" cluster = "yashandb" yas_type = "SE" secret_key = "64f955c9f00b01dc" isLocal = true add_yasdba = true [om] hostid = "host0001" [om.config] LISTEN_ADDR = "127.0.0.1:1675" [[host]] hostid = "host0001" group = "yashan" user = "yashan" password = "lhr" ip = "127.0.0.1" port = 22 path = "/yashandb/install" jvm_path = "" total_memory = 0 [host.yasagent] [host.yasagent.config] LISTEN_ADDR = "127.0.0.1:1676" [yashan@lhryashandb install]$ [yashan@lhryashandb install]$ ./bin/yasboot package install -t /yashandb/install/hosts.toml -i yashandb-personal-23.1.0.100-linux-x86_64.tar.gz checking install profile.toml... install version: yashandb 23.1.1.100 update host to yasom... [yashan@lhryashandb install]$ ./bin/yasboot cluster deploy -t /yashandb/install/yashandb.toml type | uuid | name | hostid | index | status | return_code | progress | cost ------------------------------------------------------------------------------------------------------------ task | 95d5d822b67ec478 | DeployYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 9 ------+------------------+--------------------+--------+----------+---------+-------------+----------+------ task completed, status: SUCCESS [yashan@lhryashandb install]$ [yashan@lhryashandb conf]$ cat yashandb.bashrc export YASDB_HOME=/yashandb/install export PATH=${YASDB_HOME}/bin:$PATH export LD_LIBRARY_PATH=${YASDB_HOME}/lib:$LD_LIBRARY_PATH if command -v rlwrap >/dev/null 2>&1; then alias yasql="rlwrap yasql" fi export YASDB_DATA=/yashandb/data/db-1-1 [yashan@lhryashandb conf]$ cd /yashandb/install/conf [yashan@lhryashandb conf]$ cat yashandb.bashrc >> ~/.bashrc [yashan@lhryashandb conf]$ source ~/.bashrc [yashan@lhryashandb conf]$ [yashan@lhryashandb instance]$ yaspwd file=yasdb.pwd password=lhra@123 [yashan@lhryashandb instance]$ yasboot cluster status -c yashandb host_id | node_type | nodeid | pid -------------------------------------- host0001 | db | 1-1:1 | 1085 ----------+-----------+--------+------ [yashan@lhryashandb instance]$ yasql 'sys/"lhra@123"' YashanDB SQL Personal Edition Release 23.1.1.100 x86_64 Connected to: YashanDB Server Personal Edition Release 23.1.1.100 x86_64 - X86 64bit Linux SQL> SQL> select * from v$version; BANNER VERSION_NUMBER ---------------------------------------------------------------- ----------------- Personal Edition Release 23.1.1.100 x86_64 23.1.1.100 1 row fetched. SQL> |
环境变量
使用临时配置方法配置环境变量不会生成环境变量信息,如下为使用永久生效方法配置的环境变量信息:
1 2 3 4 5 6 7 8 | export YASDB_HOME=/home/yashan/yasdb_home/yashandb/23.1.0.100 export PATH=${YASDB_HOME}/bin:$PATH export LD_LIBRARY_PATH=${YASDB_HOME}/lib:$LD_LIBRARY_PATH if command -v rlwrap >/dev/null 2>&1; then alias yasql="rlwrap yasql" fi export YASDB_DATA=/home/yashan/yasdb_data/db-1-1 |
YASDB_HOME
YASDB_HOME环境变量所指向路径为YashanDB的HOME目录,包含产品相关程序文件。
YASDB_DATA
YASDB_DATA环境变量所指向路径为YashanDB的DATA目录,包含产品相关数据文件。
$YASDB_HOME/bin
$YASDB_HOME/bin目录包含YashanDB配套工具,将其加入PATH系统路径使其可以直接运行。
LD_LIBRARY_PATH
LD_LIBRARY_PATH环境变量所指向路径为YashanDB的LIB目录,包含产品运行所需库文件。
启动和关闭
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 | -- 查看YashanDB数据库状态 yasboot cluster status -c yashandb -- 启动 yasboot process yasom start -c yashandb yasboot process yasagent start -c yashandb yasboot cluster start -c yashandb -- 重启 yasboot cluster restart -c yashandb -- 停止 yasboot cluster stop -c yashandb -- 端口 [yashan@lhryashandb ~]$ netstat -tulnp | grep yas (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 127.0.0.1:1675 0.0.0.0:* LISTEN 416/yasom tcp 0 0 127.0.0.1:1676 0.0.0.0:* LISTEN 451/yasagent tcp 0 0 0.0.0.0:1688 0.0.0.0:* LISTEN 476/yasdb tcp 0 0 127.0.0.1:1689 0.0.0.0:* LISTEN 476/yasdb |
执行如下SQL命令查看当前实例状态及数据库名称:
1 2 3 4 5 6 7 8 9 10 11 12 | SELECT status FROM V$INSTANCE; STATUS ----------------- OPEN SELECT database_name FROM V$DATABASE; DATABASE_NAME ---------------------------------------------------------------- yashandb |
执行如下命令关闭YashanDB服务:
1 2 3 4 5 6 | $ yasboot cluster stop -c yashandb type | uuid | name | hostid | index | status | return_code | progress | cost ---------------------------------------------------------------------------------------------------------- task | 3b62bda48bad7fd1 | StopYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 1 ------+------------------+------------------+--------+----------+---------+-------------+----------+------ task completed, status: SUCCESS |