1. 程式人生 > >Centos7.0上安裝Vertica9.1.1

Centos7.0上安裝Vertica9.1.1

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字眼則為安裝成功。

 

[[email protected] 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.

[[email protected] 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

安裝日誌如下:

 

[[email protected] 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  ]

[[email protected] opt]#

 

開啟 https://101.12.82.103:5450/webui 進行驗證配置

4. 配置vertica叢集資料庫

4.1 使用MC配置vertica

1. 建立叢集

 

2. 在叢集上建立資料庫

 

3. 上傳license檔案

 

4.2 使用vsql操作vertica

[[email protected] opt]# su - dbadmin

Last login: Wed Nov 28 13:58:05 CST 2018 on pts/0

[[email protected] ~]$ 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

[[email protected] ~]$

4.3 使用admintools管理vertica

[[email protected] ~]$ 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