ColumnStore完整验证指南之安装与启动停止

官方文档https://mariadb.com/kb/en/library/mariadb-columnstore/

推荐使用最新1.2.x最新版本。

先决条件

yum -y install boost
yum -y install expect perl perl-DBI openssl zlib file sudo libaio rsync snappy net-tools numactl-libs nmap

安装1.0的jemalloc,可下载rpm包如jemalloc-3.6.0-1.el7.x86_64.rpm。

安装(单机)

推荐下载linux二进制版本https://downloads.mariadb.com/ColumnStore/1.2.2/centos/x86_64/7/mariadb-columnstore-1.2.2-1-centos7.x86_64.bin.tar.gz,更加透明。

直接运行自带shell命令/usr/local/mariadb/columnstore/bin/quick_installer_single_server.sh即可完成单机版本安装与启动。

使用这种模式安装的columnstore并没有独立UM模块,而是作为原生进程存在(否则、至少需要2台服务器)。

安装完成后,建议执行命令/usr/local/mariadb/columnstore/bin/columnstoreAlias为columnstore的两个主要客户端:SQL客户端以及mcsadmin(MariaDB ColumnStore MySQL Console)创建别名:

其中:

# 和非columnstore引擎的mysql是一样的
mcsmysql = /usr/local/mariadb/columnstore/mysql/bin/mysql
--defaults-file=/usr/local/mariadb/columnstore/mysql/my.cnf
-u root # 默认密码为空 mcsadmin = /usr/lodcal/mariadb/columnstore/bin/mcsadmin

然后就可以检查节点状态了(节点状态异常是可用来查看),如下所示:

[root@oel-12c ~]# mcsadmin getsysteminfo
getsysteminfo Wed Mar 13 15:52:54 2019 System columnstore-1 System and Module statuses Component Status Last Status Change
------------ -------------------------- ------------------------
System ACTIVE Tue Mar 12 13:35:07 2019 Module pm1 ACTIVE Tue Mar 12 13:34:59 2019 MariaDB ColumnStore Process statuses Process Module Status Last Status Change Process ID
------------------ ------ --------------- ------------------------ ----------
ProcessMonitor pm1 ACTIVE Tue Mar 12 13:34:23 2019 1281
ProcessManager pm1 ACTIVE Tue Mar 12 13:34:29 2019 1838
DBRMControllerNode pm1 ACTIVE Tue Mar 12 13:34:39 2019 2428
ServerMonitor pm1 ACTIVE Tue Mar 12 13:34:42 2019 2447
DBRMWorkerNode pm1 ACTIVE Tue Mar 12 13:34:42 2019 2465
PrimProc pm1 ACTIVE Tue Mar 12 13:34:45 2019 2544
ExeMgr pm1 ACTIVE Tue Mar 12 13:34:50 2019 2628
WriteEngineServer pm1 ACTIVE Tue Mar 12 13:34:54 2019 2685
DDLProc pm1 ACTIVE Tue Mar 12 13:34:58 2019 2756
DMLProc pm1 ACTIVE Tue Mar 12 13:35:06 2019 2827
mysqld pm1 ACTIVE Tue Mar 12 13:34:36 2019 2260 Active Alarm Counts: Critical = 0, Major = 0, Minor = 0, Warning = 0, Info = 0
[root@oel-12c ~]# mcsadmin getsystemstatus
getsystemstatus Wed Mar 13 15:53:05 2019 System columnstore-1 System and Module statuses Component Status Last Status Change
------------ -------------------------- ------------------------
System ACTIVE Tue Mar 12 13:35:07 2019 Module pm1 ACTIVE Tue Mar 12 13:34:59 2019

ColumnStore完整验证指南之安装与启动停止

查看后台进程状态

ColumnStore完整验证指南之安装与启动停止

查看所有支持的命令:

[root@oel-12c ~]# mcsadmin help
help Wed Mar :: List of commands:
Note: the command must be the first entry entered on the command line Command Description
------------------------------ --------------------------------------------------------
? Get help on the Console Commands
addDbroot Add DBRoot Disk storage to the MariaDB Columnstore System
addModule Add a Module within the MariaDB Columnstore System
alterSystem-disableModule Disable a Module and Alter the MariaDB Columnstore System
alterSystem-enableModule Enable a Module and Alter the MariaDB Columnstore System
assignDbrootPmConfig Assign unassigned DBroots to Performance Module
assignElasticIPAddress Assign Amazon Elastic IP Address to a module
disableLog Disable the levels of process and debug logging
disableMySQLReplication Disable MySQL Replication functionality on the system

查看命令的详细参数:

[root@oel-12c ~]# mcsadmin help getsysteminfo
help Wed Mar :: Command: getSystemInfo Description: Get the Over-all System Statuses
Get the System, Module, Process, and Active Alarm Statuses Arguments: None

进入mcsadmin控制台:

[root@oel-12c ~]# mcsadmin

MariaDB ColumnStore Admin Console
enter 'help' for list of commands
enter 'exit' to exit the MariaDB ColumnStore Command Console
use up/down arrows to recall commands Active Alarm Counts: Critical = , Major = , Minor = , Warning = , Info = Critical Active Alarms:

进入SQL控制台(密码默认空):

[root@oel-12c ~]# mcsmysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is
Server version: 10.3.-MariaDB-log Columnstore 1.2.- Copyright (c) , , Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>

修改密码、远程登录(同普通mysql),如下:

MariaDB [(none)]> create user root@'%' identified by "";
Query OK, rows affected (0.001 sec) MariaDB [(none)]> grant all on *.* to root@'%';
Query OK, rows affected (0.000 sec) MariaDB [(none)]> exit
Bye
[root@oel-12c ~]# lsof -i:3306 # 端口,同普通mysql
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld mysql 26u IPv6 0t0 TCP *:mysql (LISTEN)
[root@oel-12c ~]#

使用IDE访问:

ColumnStore完整验证指南之安装与启动停止

所以,columnstore仅仅只是一个引擎,上层架构相同。下层分布式,和mysql ndb cluster的架构是一样的。

停止和启动

系统停止

完全停止columnstore(包括管理控制台和告警服务,停止后一个进程都没了):

[root@oel-12c ~]# ps axu | grep columnstore
root 0.0 0.0 ? S 3月12 : /bin/bash /usr/local/mariadb/columnstore/bin/run.sh -l /tmp/columnstore_tmp_files /usr/local/mariadb/columnstore/bin/ProcMon
root 0.2 0.4 ? Sl 3月12 : /usr/local/mariadb/columnstore/bin/ProcMon
root 0.0 0.0 ? S 3月12 : /bin/sh /oradata/mariadb/columnstore/mysql//bin/mysqld_safe --datadir=/oradata/mariadb/columnstore/mysql/db --pid-file=/oradata/mariadb/columnstore/mysql/db/oel-12c.pid --ledir=/oradata/mariadb/columnstore/mysql//bin
mysql 0.0 3.1 ? Sl 3月12 : /oradata/mariadb/columnstore/mysql//bin/mysqld --basedir=/oradata/mariadb/columnstore/mysql/ --datadir=/oradata/mariadb/columnstore/mysql/db --plugin-dir=/oradata/mariadb/columnstore/mysql/lib/plugin --user=mysql --log-error=/oradata/mariadb/columnstore/mysql/db/oel-12c.err --pid-file=/oradata/mariadb/columnstore/mysql/db/oel-12c.pid --socket=/oradata/mariadb/columnstore/mysql/lib/mysql/mysql.sock --port=3306
root 0.0 0.3 ? Sl 3月12 : /usr/local/mariadb/columnstore/bin/controllernode fg
root 0.1 0.3 ? Sl 3月12 : /usr/local/mariadb/columnstore/bin/ServerMonitor
root 0.0 0.4 ? Sl 3月12 : /usr/local/mariadb/columnstore/bin/workernode DBRM_Worker1 fg
root 0.0 0.0 pts/ S+ : : grep --color=auto columnstore
[root@oel-12c ~]# mcsadmin shutdownSystem y
shutdownsystem Wed Mar :: This command stops the processing of applications on all Modules within the MariaDB ColumnStore System Checking for active transactions Stopping System...
Successful stop of System Shutting Down System...
Successful shutdown of System [root@oel-12c ~]# ps axu | grep columnstore
root 0.0 0.0 pts/ S+ : : grep --color=auto columnstore

启动系统(异常时可用来启动):

[root@oel-12c ~]# mcsadmin startSystem
startsystem Wed Mar :: startSystem command, 'columnstore' service is down, sending command to
start the 'columnstore' service on all modules System being started, please wait........
Successful start of System [root@oel-12c ~]# ps axu | grep columnstore
root 0.0 0.0 pts/ S : : /bin/bash /usr/local/mariadb/columnstore/bin/run.sh -l /tmp/columnstore_tmp_files /usr/local/mariadb/columnstore/bin/ProcMon
root 19.8 0.4 pts/ Sl : : /usr/local/mariadb/columnstore/bin/ProcMon
root 0.0 0.0 pts/ S : : /bin/sh /oradata/mariadb/columnstore/mysql//bin/mysqld_safe --datadir=/oradata/mariadb/columnstore/mysql/db --pid-file=/oradata/mariadb/columnstore/mysql/db/oel-12c.pid --ledir=/oradata/mariadb/columnstore/mysql//bin
mysql 0.4 3.0 pts/ Sl : : /oradata/mariadb/columnstore/mysql//bin/mysqld --basedir=/oradata/mariadb/columnstore/mysql/ --datadir=/oradata/mariadb/columnstore/mysql/db --plugin-dir=/oradata/mariadb/columnstore/mysql/lib/plugin --user=mysql --log-error=/oradata/mariadb/columnstore/mysql/db/oel-12c.err --pid-file=/oradata/mariadb/columnstore/mysql/db/oel-12c.pid --socket=/oradata/mariadb/columnstore/mysql/lib/mysql/mysql.sock --port=3306
root 0.0 0.3 pts/ Sl : : /usr/local/mariadb/columnstore/bin/controllernode fg
root 0.1 0.3 pts/ Sl : : /usr/local/mariadb/columnstore/bin/ServerMonitor
root 0.0 0.4 pts/ Sl : : /usr/local/mariadb/columnstore/bin/workernode DBRM_Worker1 fg
root 0.0 0.0 pts/ S+ : : grep --color=auto columnstore

停止应用(跟rac不停止cluster类似,相当于重启库本身):

[root@oel-12c ~]# mcsadmin stopSystem y   #此时客户端发送请求,将收到 [Err] 1815 - Internal error: The system is not yet ready to accept queries
stopsystem Wed Mar :: This command stops the processing of applications on all Modules within the MariaDB ColumnStore System Checking for active transactions System being stopped now...
Successful stop of System [root@oel-12c ~]# ps axu | grep columnstore
root 0.0 0.0 pts/ S : : /bin/bash /usr/local/mariadb/columnstore/bin/run.sh -l /tmp/columnstore_tmp_files /usr/local/mariadb/columnstore/bin/ProcMon
root 7.9 0.4 pts/ Sl : : /usr/local/mariadb/columnstore/bin/ProcMon
root 0.0 0.0 pts/ S+ : : grep --color=auto columnstore

最近测试发现个额外现象。mcsadmin startSystem后,重新连接报"[Err] 1815 - Internal error: fatal error running mysql_real_connect() in libmysql_client lib (1045) (Access denied for user 'root'@'localhost' (using password: NO))",各种进程、模块状态都是正常的。

常规的SQL以及DDL、建库等和普通mysql一样,唯一的差别是引擎要声明为columnstore,如下:

create database mcs;
use mcs;
create table idbtest(col1 int, col2 int) engine=columnstore;
show create table idbtest;
insert into idbtest values (1, 2);
insert into idbtest values (3, 4);
select * from idbtest;

设置utf-8

vim /usr/local/mariadb/columnstore/mysql/my.cnf

[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
init-connect=’SET NAMES utf8’ 设置columnstore本身的本地语言(建议不要直接修改配置文件/usr/local/mariadb/columnstore/etc/Columnstore.xml),改了后要通过mcsadmin stopSystem/startSystem使之生效:
/usr/local/mariadb/columnstore/bin/setConfig SystemConfig SystemLang en_US.utf8

将文件转换为utf-8格式:
iconv -f ISO-8859-1 -t UTF-8 < input.txt > output.txt
上一篇:Object.defineProperty实现数据绑定


下一篇:LinuxC安装gcc