Centos7.0上安装Vertica9.1.1
1. 主机环境准备
IP |
主机名 |
服务器配置 |
Swap分区 |
文件系统 |
磁盘大小 |
挂载点 |
OS |
101.12.82.103 |
vh001 |
8核16G内存 |
2G |
ext4 |
200G |
/ |
Centos7.0 |
101.12.82.104 |
vh002 |
8核16G内存 |
2G |
ext4 |
200G |
/ |
Centos7.0 |
101.12.82.105 |
vh003 |
8核16G内存 |
2G |
ext4 |
200G |
/ |
Centos7.0 |
2. 安装前准备
2.1 修改主机名和/ect/hosts文件并关闭selinux
三个节点的/etc/sysconfig/network中分别添加 hostname vh001 hostname vh002 hostname vh003 三个节点的/etc/hosts文件中都添加 101.12.82.103 vh001 101.12.82.104 vh002 101.12.82.105 vh003 修改/etc/selinux/config文件将SELINUX=enforcing改为SELINUX=disabled 三个节点都重启生效,后续操作无特殊说明均为三个节点都执行 init 6 |
2.2 手工添加swap分区
检查系统是否有至少2G的swap分区 df –Th 没有则手工添加 dd if=/dev/zero of=/home/swap bs=1024 count=2048000 mkswap /home/swap swapon /home/swap echo "/home/swap swap swap defaults 0 0" >> /etc/fstab 验证是否添加成功 free –m |
2.3 关闭防火墙
systemctl stop firewalld.service systemctl disable firewalld.service firewall-cmd --state |
2.4 关闭非必要的服务
systemctl disable avahi-daemon.service systemctl disable avahi-dnsconfd.service systemctl disable conman.service systemctl disable bluetooth.service systemctl disable cpuspeed.service systemctl disable setroubleshoot.service systemctl disable hidd.service systemctl disable hplip.service systemctl disable isdn.service systemctl disable kudzu.service systemctl disable yum-updatesd.service |
2.5 修改系统参数/etc/sysctl.conf
修改/etc/sysctl.conf文件增加以下参数 kernel.pid_max = 524288 vm.max_map_count = 16527169 vm.dirty_background_ratio = 1 vm.dirty_ratio = 2 kernel.hung_task_panic = 0 生效 sysctl -p |
2.6 修改磁盘预读参数/etc/rc.local
修改/etc/rc.local文件增加以下内容 echo deadline > /sys/block/vda/queue/scheduler /sbin/blockdev --setra 8192 /dev/vda echo always > /sys/kernel/mm/transparent_hugepage/enabled echo always > /sys/kernel/mm/transparent_hugepage/defrag echo 0 > /proc/sys/vm/swappiness 生效 source /etc/rc.local |
2.7 设置语言和时区/etc/profile
修改/etc/profile文件增加以下内容: export LANG="en_US.UTF-8" export TZ="Asia/Shanghai" 生效 source /etc/profile |
2.8 配置本地yum源安装支撑工具
上传centos7.0安装介质CentOS-7.0-1406-x86_64-DVD.iso到/opt目录 挂载iso文件 mount /opt/*.iso /mnt –r 备份其他源到bak目录 mkdir /etc/yum.repos.d/bak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak 创建/etc/yum.repos.d/base.repo新增如下内容 [base] name=base baseurl=file:///mnt/ gpgcheck=0 enabled=1 清理yum缓存,查看本地源是否配置成功 yum clean all yum list 安装支撑工具 yum -y install pstack yum -y install mcelog yum -y install sysstat yum -y install dialog |
2.9 建立多机互信
创建ssh配置文件 yum install openssh-clients ssh-keygen -t rsa 该命令会生成密钥文件和私钥文件id_rsa,id_rsa.pub 将vh001服务器上的id_rsa.pub合并到vh002和vh003的~/.ssh/authorized_keys文件 ssh-copy-id -i /root/.ssh/id_rsa.pub vh002 ssh-copy-id -i /root/.ssh/id_rsa.pub vh003 在vh002和vh003上分别同样做如上操作 ssh-copy-id -i /root/.ssh/id_rsa.pub vh001 ssh-copy-id -i /root/.ssh/id_rsa.pub vh003 ssh-copy-id -i /root/.ssh/id_rsa.pub vh001 ssh-copy-id -i /root/.ssh/id_rsa.pub vh002 测试免密码登录 ssh vh002 exit |
2.10 配置时钟同步
yum install ntp 设置vh001服务器做内部时钟服务器 vh001修改/etc/ntp.conf文件,添加 server 127.127.1.0 启动服务 systemctl start ntpd.service systemctl enable ntpd.service vh002服务器优先与vh001服务器同步,修改/etc/ntp.conf启动ntpd服务 /etc/ntp.conf增加以下内容: server vh001 prefer 启动服务 systemctl start ntpd.service systemctl enable ntpd.service vh003服务器优先与vh001服务器同步,其次与vh002同步,修改/etc/ntp.conf启动ntpd服务 /etc/ntp.conf增加以下内容: server vh001 prefer server vh002 启动服务 systemctl start ntpd.service systemctl enable ntpd.service 检查时钟同步结果 ntpdate -u vh001 |
3. 安装vertica
3.1 使用root用户安装vertica rpm包
将vertica-9.1.1-0.x86_64.RHEL6.rpm上传到vh001节点/opt目录 升级安装rmp包 rpm -Uvh vertica-9.1.1-0.x86_64.RHEL6.rpm |
3.2 使用root用户安装vertica数据库
/opt/vertica/sbin/install_vertica --hosts vh001,vh002,vh003 --rpm vertica-9.1.1-0.x86_64.RHEL6.rpm 屏幕输出如下: 无FAIL字眼则为安装成功。 |
[root@vh001 opt]# /opt/vertica/sbin/install_vertica --host vh001,vh002,vh003 --rpm vertica-9.1.1-0.x86_64.RHEL6.rpm Vertica Analytic Database 9.1.1-0 Installation Tool >> Validating options... Mapping hostnames in --hosts (-s) to addresses... vh001 => 101.12.82.103 vh002 => 101.12.82.104 vh003 => 101.12.82.105 >> Starting installation tasks. >> Getting system information for cluster (this may take a while)... Default shell on nodes: 101.12.82.105 /bin/bash 101.12.82.104 /bin/bash 101.12.82.103 /bin/bash >> Validating software versions (rpm or deb)... >> Beginning new cluster creation... successfully backed up admintools.conf on 101.12.82.103 >> Installing software (rpm or deb)... Installing rpm on 2 hosts.... installing node.... 101.12.82.105 installing node.... 101.12.82.104 >> Creating or validating DB Admin user/group... Password for new dbadmin user (empty = disabled) Successful on hosts (3): 101.12.82.105 101.12.82.104 101.12.82.103 Provided DB Admin account details: user = dbadmin, group = verticadba, home = /home/dbadmin Creating group... Adding group Validating group... Okay Creating user... Adding user, Setting credentials Validating user... Okay >> Validating node and cluster prerequisites... System prerequisites passed. Threshold = WARN >> Establishing DB Admin SSH connectivity... Installing/Repairing SSH keys for dbadmin >> Setting up each node and modifying cluster... Creating Vertica Data Directory... Updating agent... Creating node node0001 definition for host 101.12.82.103 ... Done Creating node node0002 definition for host 101.12.82.104 ... Done Creating node node0003 definition for host 101.12.82.105 ... Done >> Sending new cluster configuration to all nodes... Starting agent... >> Completing installation... Running upgrade logic No spread upgrade required: /opt/vertica/config/vspread.conf not found on any node Installation complete. Please evaluate your hardware using Vertica's validation tools: https://my.vertica.com/docs/9.1.x/HTML/index.htm#cshid=VALSCRIPT To create a database: 1. Logout and login as dbadmin. (see note below) 2. Run /opt/vertica/bin/adminTools as dbadmin 3. Select Create Database from the Configuration Menu Note: Installation may have made configuration changes to dbadmin that do not take effect until the next session (logout and login). To add or remove hosts, select Cluster Management from the Advanced Menu. [root@vh001 opt]# |
3.3 安装MC管理工具
上传vertica-console-9.1.1-0.x86_64.RHEL6.rpm到vh001节点/opt目录进行安装 rpm -Uvh vertica-console-9.1.1-0.x86_64.RHEL6.rpm 安装日志如下: |
[root@vh001 opt]# rpm -Uvh vertica-console-9.1.1-0.x86_64.RHEL6.rpm Preparing... ################################# [100%] [preinstall] Starting installation.... Updating / installing... 1:vertica-console-9.1.1-0 ################################# [100%] [postinstall] copy vertica-consoled [postinstall] configure the daemon service Cleaning up temp folder... Starting the vertica management console.... Vertica Console: 2018-11-28 10:18:07.358:INFO:cv.Startup:Attempting to load properties from /opt/vconsole/config/console.properties 2018-11-28 10:18:07.359:INFO:cv.Startup:Starting Server... 2018-11-28 10:18:07.439:INFO:cv.Startup:starting monitor thread 2018-11-28 10:18:07.444:INFO:oejs.Server:jetty-7.x.y-SNAPSHOT 2018-11-28 10:18:07.476:INFO:oejw.WebInfConfiguration:Extract jar:file:/opt/vconsole/lib/webui.war!/ to /opt/vconsole/temp/webapp 2018-11-28 10:18:13.342:INFO:/webui:Set web app root system property: 'webapp.root' = [/opt/vconsole/temp/webapp] 2018-11-28 10:18:13.369:INFO:/webui:Initializing log4j from [classpath:log4j.xml] 2018-11-28 10:18:13.392:INFO:/webui:Initializing Spring root WebApplicationContext ---- Upgrading /opt/vconsole/config/console.properties ---- ************************************************************************************************************ Please open the Vertica Management Console at https://vh001:5450/webui ************************************************************************************************************ 2018-11-28 10:18:41.844:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/webui,file:/opt/vconsole/temp/webapp/},file:/opt/vconsole/lib/webui.war 2018-11-28 10:18:41.912:INFO:/webui:Initializing Spring FrameworkServlet 'appServlet' 2018-11-28 10:18:44.695:INFO:oejdp.ScanningAppProvider:Deployment monitor /opt/vconsole/webapps at interval 2 2018-11-28 10:18:44.759:INFO:oejhs.SslContextFactory:Enabled Protocols [SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2] of [SSLv2Hello, SSLv3, TLSv1, TLSv1.1, TLSv1.2] 2018-11-28 10:18:44.780:INFO:oejs.AbstractConnector:Started [email protected]:5450 STARTING start OK [postinstall] Changing permissions of /opt/vconsole [ OK ] [root@vh001 opt]# |
打开 https://101.12.82.103:5450/webui 进行验证配置 |
4. 配置vertica集群数据库
4.1 使用MC配置vertica
1. 创建集群
2. 在集群上创建数据库
3. 上传license文件
4.2 使用vsql操作vertica
[root@vh001 opt]# su - dbadmin Last login: Wed Nov 28 13:58:05 CST 2018 on pts/0 [dbadmin@vh001 ~]$ vsql Password: Welcome to vsql, the Vertica Analytic Database interactive terminal. Type: \h or \? for help with vsql commands \g or terminate with semicolon to execute query \q to quit dbadmin=> \h See https://my.vertica.com/documentation/vertica/9.1.x for information on available commands. General \c[onnect] [DBNAME|- [USER]] connect to new database (currently "dbadmin") \cd [DIR] change the current working directory \q quit vsql \set [NAME [VALUE]] set internal variable, or list all if no parameters \timing [on|off] toggle timing of commands, or explicitly turn it on or off (currently off) \unset NAME unset (delete) internal variable \! [COMMAND] execute command in shell or start interactive shell \password [USER] change user's password Query Buffer \e [FILE] edit the query buffer (or file) with external editor \g send query buffer to server \g FILE send query buffer to server and results to file \g | COMMAND send query buffer to server and pipe results to command \p show the contents of the query buffer \r reset (clear) the query buffer \s [FILE] display history or save it to file \w FILE write query buffer to file Input/Output \echo [STRING] write string to standard output \i FILE execute commands from file \o FILE send all query results to file \o | COMMAND pipe all query results to command \o close query-results file or pipe \qecho [STRING] write string to query output stream (see \o) Informational \d [PATTERN] describe tables (list tables if no argument is supplied) PATTERN may include system schema name, e.g. v_catalog.* \df [PATTERN] list functions \dj [PATTERN] list projections \dn [PATTERN] list schemas \dp [PATTERN] list table access privileges \ds [PATTERN] list sequences \dS [PATTERN] list system tables. PATTERN may include system schema name such as v_catalog, v_monitor, or v_internal. Example: v_catalog.a* \dt [PATTERN] list tables \dtv [PATTERN] list tables and views \dT [PATTERN] list data types \du [PATTERN] list users \dv [PATTERN] list views \l list all databases \z [PATTERN] list table access privileges (same as \dp) Formatting \a toggle between unaligned and aligned output mode \b toggle beep on command completion \C [STRING] set table title, or unset if none \f [STRING] show or set field separator for unaligned query output \H toggle HTML output mode (currently off) \pset NAME [VALUE] set table output option (NAME := {format|border|expanded|fieldsep|footer|null| recordsep|trailingrecordsep|tuples_only|title|tableattr|pager}) \t show only rows (currently off) \T [STRING] set HTML <table> tag attributes, or unset if none \x toggle expanded output (currently off) dbadmin=> \q [dbadmin@vh001 ~]$ |
4.3 使用admintools管理vertica
[dbadmin@vh001 ~]$ admintools |
Admintools为交互式管理工具,按键操作指南:
按键 |
功能 |
Tab |
在确定(OK)、取消(Cancel)、帮助(Help) 和菜单之间切换。 |
向上/向下箭头 |
在菜单、窗口或帮助文件中上下移动光标。 |
空格键 |
选择列表中的项。 |
字符 |
从菜单中选择相应的命令 |
5. 使用vertica自带的性能测试工具
5.1 使用vioperf进行磁盘IO性能测试
cd /opt/vertica/bin ./vioperf /home/dbadmin |
输出顺序写、顺序读写、顺序读、随机读的磁盘IP性能。
5.2 使用vnetperf进行网络性能测试
cd /opt/vertica/bin ./vnetperf --host vh001,vh002,vh003 |
6. 卸载vertica
root用户分别删除每个节点上的vertica-patch包,vertica包,vertica-console包。
/etc/init.d/vertica-consoled stop ps -ef | grep vertica | awk '{print "kill -9 " $2}' | sh rpm -qa | grep vertica rpm -e vertica-ms-9.1.1-1.x86_64 rpm -e vertica-9.1.1-0.x86_64 rpm -e vertica-console-9.1.1-0.x86_64 cd /opt rm -rf vertica rm -rf vconsole |