【准备】
1、CentOS 7.6操作系统
2、ext4分区
3、vertica-9.3.1-4.x86_64.RHEL6
4、yum源
三台机器:
10.1.125.39
10.1.125.40
10.1.125.41
【安装过程】
1、安装依赖包
[root@localhost ~]# yum install pstack mcelog sysstat dialog ntp -y
2、关闭防火墙
[root@localhost ~]# systemctl mask firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl stop firewalld
3、设置SELINUX
[root@localhost ~]# vi /etc/selinux/config
SELINUX=disabled
[root@localhost ~]# setenforce 0
4、确认Python版本,要求2.7版本以上
[root@localhost ~]# which python
/usr/bin/python
[root@localhost ~]# python --version
Python 2.7.5
[root@localhost ~]#
5、安装rsync,要求3.0.5版本以上
[root@localhost ~]# yum install rsync -y
[root@localhost ~]# rsync --version
rsync version 3.1.2 protocol version 31
6、确认pts
[root@localhost ~]# ls /dev |grep pts
pts
7、确认磁盘分区
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 4.4T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
├─sda3 8:3 0 4.3T 0 part /home
├─sda4 8:4 0 50G 0 part /
└─sda5 8:5 0 4G 0 part [SWAP]
8、确认磁盘类型,数据库准备安装到/home目录下,所以,"/home"必须是ext4
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Apr 27 17:58:59 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=f81a61fc-25a9-4250-8692-a72644302c15 / ext4 defaults 1 1
UUID=f20047a1-d7da-4b8a-8592-f2f8cafc229d /boot ext4 defaults 1 2
UUID=7154fd9c-3be8-4788-8c21-e892126be7cd /home ext4 defaults 1 2
UUID=b35075b7-5049-47a0-91f8-719116955148 swap swap defaults 0 0
9、修改I/O scheduler
[root@localhost ~]# echo deadline > /sys/block/sda/queue/scheduler
[root@localhost ~]# echo deadline > /dev/sda2
10、安装JDK1.8
[root@localhost ~]# yum install java-1.8.0-openjdk.x86_64 -y
[root@localhost ~]# java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
11、安装依赖的一组服务
[root@localhost ~]# yum install gdb mcelog sysstat chrony ntp ntpdate -y
[root@localhost ~]# systemctl start chronyd
[root@localhost ~]# systemctl status chronyd
[root@localhost ~]# systemctl start ntpd.service
[root@localhost ~]# systemctl enable ntpd.service
12、调整参数
[root@localhost ~]# vi /etc/sysctl.conf
vm.swappiness = 1
[root@localhost ~]# echo 1 > /proc/sys/vm/swappiness
13、设置ntd时间服务器
[root@localhost ~]# vi /etc/ntp.conf
server 10.1.125.42 iburst
14、设置ssh免密访问
在三台主机上分别执行:
[root@localhost ~]# ssh-keygen -t rsa
一切默认,不用输入密码,生成两个文件:
/root/.ssh/id_rsa
/root/.ssh/id_rsa.pub
在第一台主机上生成authorized_keys文件:
[root@localhost ~]# touch /root/.ssh/authorized_keys
[root@localhost ~]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
[root@localhost ~]# chmod 700 /root/.ssh/id_rsa
把另外2台的/root/.ssh/id_rsa.pub文件内容合并到第一台的/root/.ssh/authorized_keys中。
最后,把第一台的/root/.ssh/authorized_keys拷贝到另外两台主机。
[root@localhost ~]# scp /root/.ssh/authorized_keys root@10.1.125.40:/root/.ssh/
[root@localhost ~]# scp /root/.ssh/authorized_keys root@10.1.125.41:/root/.ssh/
15、设置时区
修改文件/etc/profile增加如下内容:
export LANG="en_US.UTF-8"
export TZ="Asia/Shanghai"
16、修改磁盘预读参数
修改文件/etc/profile增加如下内容:
[root@localhost ~]# echo '/sbin/blockdev --setra 2048 /dev/sda3' >> /etc/rc.local
[root@localhost ~]# /sbin/blockdev --setra 2048 /dev/sda3
17、重启操作系统
[root@localhost ~]# reboot
18、解压缩vertica 9.3
[root@localhost ~]# rpm -ivh vertica-9.3.1-4.x86_64.RHEL6.rpm
[root@localhost ~]# ls /opt/vertica/
19、安装vertica
[root@localhost ~]# /opt/vertica/sbin/install_vertica --hosts 10.1.125.39,10.1.125.40,10.1.125.41 --rpm vertica-9.3.1-4.x86_64.RHEL6.rpm --failure-threshold FAIL --point-to-point
如果提示有WARN或FATAL,按照提示解决。
如果可以正常安装,会提示输入一个数据库密码。
20、初始化数据库
[root@localhost ~]# su - dbadmin
[dbadmin@localhost ~]$ cd /opt/vertica/bin/
[dbadmin@localhost bin]$ ./admintools
1、提示输入License File Path时,因为用的是社区版license,不用填,直接回车,
2、Accept EULA
3、Configuration Menu
4、Create Database
5、输入Database Name: bigdata
6、输入密码和确认密码
7、选择主机IP,因为是单节点安装,直接选择默认的那个IP
8、确认数据实例安装目录,不用改,直接用默认的,/home/dbadmin
9、会出现一个k-safe的提示,这是只有一个节点导致的,直接忽略,继续下一步
10、安装成功
*** Creating database: bigdata ***
Creating database bigdata
Starting bootstrap node v_bigdata_node0001 (10.1.125.39)
Starting nodes:
v_bigdata_node0001 (10.1.125.39)
Starting Vertica on all nodes. Please wait, databases with a large catalog may take a while to initialize.
Node Status: v_bigdata_node0001: (DOWN)
Node Status: v_bigdata_node0001: (DOWN)
Node Status: v_bigdata_node0001: (DOWN)
Node Status: v_bigdata_node0001: (DOWN)
Node Status: v_bigdata_node0001: (UP)
Automatically installing extension packages
Package: place
Success: package place successfully installed
Package: ParquetExport
Success: package ParquetExport successfully installed
Package: logsearch
Success: package logsearch successfully installed
Package: flextable
Success: package flextable successfully installed
Package: MachineLearning
Success: package MachineLearning successfully installed
Package: kafka
Success: package kafka successfully installed
Package: AWS
Success: package AWS successfully installed
Package: txtindex
Success: package txtindex successfully installed
Package: voltagesecure
Success: package voltagesecure successfully installed
Package: approximate
Success: package approximate successfully installed
21、测试连接
[dbadmin@localhost bin]$ vsql -h 127.0.0.1 -d bigdata -U dbadmin
User name: dbadmin
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
bigdata=>
测试成功!
22、查询和设置k-safe参数
bigdata=> SELECT current_fault_tolerance FROM system;
寻找当ksafe等于1时候相关的节点
bigdata=> SELECT * FROM v_monitor.critical_nodes;
设置不同ksafe值对节点的要求
K-level Number of Nodes Required
1 3+
2 5+
K 2K+1
一般k最大为2
通常情况下设置ksafe值为1,如下:
bigdata=> SELECT MARK_DESIGN_KSAFE(1);
如果要带上密码,可以用“-w”,如下:
vsql -h 127.0.0.1 -d bigdata -U dbadmin -w XXXXXX
---------------------------------------------------------------
社区版vertica默认只允许处理1TB的原始数据(raw data)。
可以通过“select get_compliance_status();”命令来查看当前的使用情况:
---------------------------------------
如果IP发生了改变,参照这里:
https://www.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/AdministratorsGuide/ManageNodes/ReMapIPs/ReMapIPOverview.htm
如果要增加的新的节点,参照这里:
https://www.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/AdministratorsGuide/ManageNodes/AddingHostsToACluster.htm