Wednesday, August 10, 2016

VERTICA INSTALLATION 3 Node Cluster

VERTICA INSTALLATION
3 Node Cluster



Vertica Version : vertica-7.2.3-0.x86_64

Edition                  : Community Edition


Cluster Type     : 3 Node Cluster
OS                     : Oracle Enterprise Linux 6.5 - 64bit

Storage Type    : Shared Storage  (NAS)
Disk Type         : ISCSI
File System       : ext4 (shared)

Get the rpm from https://my.vertica.com/community/  after registration


Setup

Setup 3 virtual machine as per above configuration.  For share drive I am using NAS.  Once done go to below mandatory setup on each nodes.  For names resolution I am using dns server for hostname resolution.

in my case below are the nodes details :

  • ·         vm212
  • ·         vm213
  • ·         vm214


[root@vm212 ~]# chkconfig sshd on
[root@vm212 ~]# service sshd start


Add below to /etc/pam.d/su



[root@vm212 ~]# vi /etc/pam.d/su
session         required        pam_limits.so

[root@vm212 ~]# vi /etc/profile

export HOSTNAME=hostname
export TZ="Asia/Kolkata"


[root@vm212 ~]# /bin/hostname
vm212.ora.com
[root@vm212 ~]# hostname
vm212.ora.com


[root@vm212 Vertica]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              52G  4.0G   45G   9% /
tmpfs                 2.5G   76K  2.5G   1% /dev/shm
192.168.1.100:/u02     77G   66G  7.5G  90% /ora_global_nfs
192.168.1.100:/DATA    99G  188M   94G   1% /DATA
192.168.1.100:/TEMP    50G  180M   47G   1% /TEMP
192.168.1.100:/FLASH   50G  180M   47G   1% /FLASH


Install dialog package

[root@vm212 Vertica]# yum install -y dialog
Loaded plugins: refresh-packagekit, security
OL6                                  | 3.7 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dialog.x86_64 0:1.1-9.20080819.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================
 Package                 Arch    Version               Repository   Size
========================================================================
Installing:
 dialog                  x86_64  1.1-9.20080819.1.el6  OL64       196 k

Transaction Summary
========================================================================
Install       1 Package(s)

Total download size: 196 k
Installed size: 515 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : dialog-1.1-9.20080819.1.el6.x86_64                                                                1/1
  Verifying  : dialog-1.1-9.20080819.1.el6.x86_64                                                                1/1

Installed:
  dialog.x86_64 0:1.1-9.20080819.1.el6

Complete!


Vertica doesn’t support transparent hugepages.

Check the installation guide or huge page setting with OS team


Installing Vertica package on Node 1

[root@vm212 Vertica]# rpm -ivh vertica-7.2.3-0.x86_64.RHEL6.rpm
Preparing...                ########################################### [100%]
   1:vertica                ########################################### [100%]

Vertica Analytic Database V7.2.3-0 successfully installed on host vm212.ora.com

To complete your NEW installation and configure the cluster, run:
 /opt/vertica/sbin/install_vertica

To complete your Vertica UPGRADE, run:
 /opt/vertica/sbin/update_vertica

----------------------------------------------------------------------------------
Important
----------------------------------------------------------------------------------
Before upgrading Vertica, you must backup your database.  After you restart your
database after upgrading, you cannot revert to a previous Vertica software version.
----------------------------------------------------------------------------------

To download the latest Vertica documentation in zip or tar format please visit
http://my.vertica.com/docs/

Validate the installed Vertica rpm

[root@vm212 Vertica]# rpm -qa | grep -i vertica
vertica-7.2.3-0.x86_64


Add   below line in /etc/profile

[root@vm214 ~]# vi /etc/profile

export TZ="Asia/Kolkata"

Verify That NTP Is Running

The network time protocol (NTP) daemon must be running on all of the hosts in the cluster so that their clocks are synchronized. The spread daemon relies on all of the nodes to have their clocks synchronized for timing purposes. If your nodes do not have NTP running, the installation can fail with a spread configuration error or other errors.

Start the NTP services on all nodes

[root@vm214 ~]# chkconfig ntpd on
[root@vm214 ~]# service ntpd start
Starting ntpd:                                             [  OK  ]


Support Tools

Vertica suggests that the following tools are installed so support can assist in troubleshooting your system if any issues arise:

pstack (or gstack) package. Identified by issue S0040 when not installed.

·         On Red Hat 7 and CentOS 7 systems, the pstack package is installed as part of the gdb package.

mcelog package. Identified by issue S0041 when not installed.
sysstat package. Identified by issue S0045 when not installed.

Red Hat 6 and CentOS 6 Systems

To install the required tools on Red Hat 6 and CentOS 6 systems, run the following commands as sudo or root:

yum install pstack -y
yum install mcelog -y
yum install sysstat -y

Red Hat 7 and CentOS 7 Systems

To install the required tools on Red Hat 7/CentOS 7 systems, run the following commands as sudo or root:

yum install gdb -y
yum install mcelog -y
yum install sysstat -y


[root@vm214 ~]# yum install -y pstack
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Package gdb-7.2-60.el6_4.1.x86_64 already installed and latest version
Nothing to do


[root@vm214 ~]# yum install -y mcelog
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mcelog.x86_64 1:1.0pre3_20120814_2-0.13.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package      Arch         Version                             Repository  Size
================================================================================
Installing:
 mcelog       x86_64       1:1.0pre3_20120814_2-0.13.el6       OL64        59 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 59 k
Installed size: 123 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : 1:mcelog-1.0pre3_20120814_2-0.13.el6.x86_64                  1/1
  Verifying  : 1:mcelog-1.0pre3_20120814_2-0.13.el6.x86_64                  1/1

Installed:
  mcelog.x86_64 1:1.0pre3_20120814_2-0.13.el6

Complete!


[root@vm214 ~]# yum install -y sysstat
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Package sysstat-9.0.4-22.el6.x86_64 already installed and latest version
Nothing to do


Filesystem Requirement

Vertica requires that your Linux file-system be either ext3 or ext4. All other file-system types are unsupported. The installer reports this issue with the identifier S0160.

Unmount the filesystem which is not ext3/ext4

[root@vm214 ~]# umount /dev/sr0
[root@vm214 ~]# /sbin/blockdev --setra 2048 /dev/sda
[root@vm214 ~]# echo '/sbin/blockdev --setra 2048 /dev/sda' >> /etc/rc.local


Disk Readahead

This topic details how to change Disk Readahead to a supported value. Vertica requires that Disk Readahead be set to at least 2048. The installer reports this issue with the identifier: S0020.

RedHat and SuSE Based Systems

For each drive in the Vertica system, Vertica recommends that you set the readahead value to at least 2048 for most deployments. The command immediately changes the readahead value for the specified disk. The second line adds the command to /etc/rc.local so that the setting is applied each time the system is booted. Note that some deployments may require a higher value and the setting can be set as high as 8192, under guidance of support.

Note: For systems that do not support /etc/rc.local, use the equivalent startup script that is run after the destination runlevel has been reached. For example SuSE uses /etc/init.d/after.local.

/sbin/blockdev --setra 2048 /dev/sda
echo '/sbin/blockdev --setra 2048 /dev/sda' >> /etc/rc.local


ISSUE

 FAIL (S0020): https://my.vertica.com/docs/7.2.x/HTML/index.htm#cshid=S0020
        Readahead size of sda (/dev/sda1) is too low for typical systems: 256 <
        2048

Prerequisites not fully met during local (OS) configuration for
verify-192.168.1.213.xml:
    FAIL (S0020): https://my.vertica.com/docs/7.2.x/HTML/index.htm#cshid=S0020
        Readahead size of sda (/dev/sda1) is too low for typical systems: 256 <
        2048

Prerequisites not fully met during local (OS) configuration for
verify-192.168.1.214.xml:
    FAIL (S0020): https://my.vertica.com/docs/7.2.x/HTML/index.htm#cshid=S0020
        Readahead size of sda (/dev/sda1) is too low for typical systems: 256 <
        2048

SOLUTION

[root@vm212 ~]# /sbin/blockdev --setra 2048 /dev/sda
[root@vm212 ~]# echo '/sbin/blockdev --setra 2048 /dev/sda' >> /etc/rc.local



[root@vm212 ~]# /opt/vertica/sbin/install_vertica -s vm212,vm213,vm214 -r /root/vertica-7.2.3-0.x86_64.RHEL6.rpm -u dbadmin -d /DATA/VERTICA

Vertica Analytic Database 7.2.3-0 Installation Tool


>> Validating options...


Mapping hostnames in --hosts (-s) to addresses...
        vm212                          => 192.168.1.212
        vm213                          => 192.168.1.213
        vm214                          => 192.168.1.214

>> Starting installation tasks.
>> Getting system information for cluster (this may take a while)...

Enter password for root@192.168.1.213 (3 attempts left):
Default shell on nodes:
192.168.1.214 /bin/bash
192.168.1.212 /bin/bash
192.168.1.213 /bin/bash

>> Validating software versions (rpm or deb)...


>> Beginning new cluster creation...

successfully backed up admintools.conf on 192.168.1.212

>> Creating or validating DB Admin user/group...

Successful on hosts (3): 192.168.1.214 192.168.1.212 192.168.1.213
    Provided DB Admin account details: user = dbadmin, group = verticadba, home = /home/dbadmin
    Creating group... Group already exists
    Validating group... Okay
    Creating user... User already exists
    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 192.168.1.212
... Done
Creating node node0002 definition for host 192.168.1.213
... Done
Creating node node0003 definition for host 192.168.1.214
... 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/7.2.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.



Here at this point cluster has been installed on 3 nodes.  It's time to create the database using admintools.

Create the database

Via using admintools you can use the configuration tool and go to the configuration menu and create a new database

Here you can create a database and associate a password through the configuration menu.

[dbadmin@vm212 ~]$  /opt/vertica/bin/admintools

Connect to the database through the VSQL Vertica client

[dbadmin@vm212 ~]$  /opt/vertica/bin/vsql -U dbadmin

After adding database .

Basic administration

dbadmin=> create user hr account unlock identified by 'oracle' ;
CREATE USER


dbadmin=> grant usage on schema public to hr ;
GRANT PRIVILEGE

dbadmin=> create user sh  ;


CREATE USER
dbadmin=> alter user sh identified by 'oracle' ;


dbadmin=> create user test ;
CREATE USER
dbadmin=> drop user test ;
DROP USER

Set the Permissions

Must be a superuser to create a role.
dbadmin=> create role hr_role ;
CREATE ROLE
dbadmin=> create role test_role ;
CREATE ROLE
dbadmin=> drop role test_role ;
DROP ROLE

dbadmin=> create schema oe;
ROLLBACK 4213:  Object "oe" already exists
dbadmin=> create table emp (empid int) ;
CREATE TABLE

dbadmin=> grant usage on schema oe to hr,sh ;
GRANT PRIVILEGE


dbadmin=> select ordinal_position,column_name, data_type FROM columns where table_name='Product_Dimension' ;

 ordinal_position |       column_name        |  data_type
------------------+--------------------------+--------------
                1 | Product_Key              | int
                2 | Product_Description      | varchar(128)
                3 | SKU_Number               | char(32)
                4 | Category_Description     | char(32)
                5 | Department_Description   | char(32)
                6 | Package_Type_Description | char(32)
                7 | Package_Size             | char(32)
                8 | Fat_Content              | int
                9 | Diet_Type                | char(32)
               10 | Weight                   | int
               11 | Weight_Units_of_Measure  | char(32)
               12 | Shelf_Width              | int
               13 | Shelf_Height             | int
               14 | Shelf_Depth              | int
(14 rows)

dbadmin=> CREATE TABLE IF NOT EXISTS hr.t (a INT, b VARCHAR(256));
CREATE TABLE

dbadmin=> CREATE TABLE IF NOT EXISTS hr.t (a INT, b VARCHAR(256));
NOTICE 4214:  Object "t" already exists; nothing was done
CREATE TABLE





Configure Backup For Database

Setup the configuration file for configuration backup.

[dbadmin@vm212 ~]$ /opt/vertica/bin/vbr.py --setupconfig
Snapshot name (backup_snapshot): vprod_backup_1
Destination Vertica DB bin directory (only required for object replication) (/opt/vertica/bin):
Number of restore points (1): 7
Specify objects (no default):
Object restore mode (coexist, createOrReplace or create) (createOrReplace):
Vertica user name (dbadmin):
Save password to avoid runtime prompt? (n) [y/n]:
Node v_vprod_node0001
Backup host name (no default): vm212.ora.com
Backup directory (no default): /VERTICA_BACKUP/vprod
Node v_vprod_node0002
Backup host name (no default): vm213.ora.com
Backup directory (no default): /VERTICA_BACKUP/vprod
Node v_vprod_node0003
Backup host name (no default): vm214.ora.com
Backup directory (no default): /VERTICA_BACKUP/vprod
Change advanced settings? (n) [y/n]:
Config file name (vprod_backup_1.ini):
Saved vbr config to vprod_backup_1.ini.


Validate the backup configuration script

[dbadmin@vm212 ~]$ more vprod_backup_1.ini
[Misc]
snapshotName = vprod_backup_1
dest_verticaBinDir = /opt/vertica/bin
restorePointLimit = 7
objectRestoreMode = createOrReplace

[Database]
dbName = vprod
dbUser = dbadmin
dbPromptForPassword = True

[Transmission]

[Mapping]
v_vprod_node0001 = vm212.ora.com:/VERTICA_BACKUP/vprod
v_vprod_node0002 = vm213.ora.com:/VERTICA_BACKUP/vprod
v_vprod_node0003 = vm214.ora.com:/VERTICA_BACKUP/vprod


First Initializing backup locations.


[dbadmin@vm212 ~]$  /opt/vertica/bin/vbr.py --task init --config-file /home/dbadmin/vprod_backup_1.ini
Initializing backup locations.
Backup locations initialized.

Start the Backup

[dbadmin@vm212 ~]$ /opt/vertica/bin/vbr.py --task backup --config-file /home/dbadmin/vprod_backup_1.ini

Starting backup of database vprod.
Participating nodes: v_vprod_node0001, v_vprod_node0002, v_vprod_node0003.
Enter vertica password:
Snapshotting database.
Snapshot complete.
Approximate bytes to copy: 202455729 of 202455729 total.
[==================================================] 100%
Copying backup metadata.
Finalizing backup.
Backup complete!


Creating script for daily backup (date wise log)

[dbadmin@vm212 ~]$ vi run_backup_vertica.sh

/opt/vertica/bin/vbr.py --task backup --config-file /home/dbadmin/vprod_backup_1.ini > /tmp/vertica_vprod_$(date +%Y%m%d%H%M%S).log


[dbadmin@vm212 ~]$ chmod +x run_backup_vertica.sh


[dbadmin@vm212 ~]$ nohup ./run_backup_vertica.sh &
[1] 17625
[dbadmin@vm212 ~]$ nohup: ignoring input and appending output to `nohup.out'

[dbadmin@vm212 ~]$
[dbadmin@vm212 ~]$ jobs
[1]+  Running                 nohup ./run_backup_vertica.sh &
[dbadmin@vm212 ~]$


[dbadmin@vm212 tmp]$ more vertica_vprod_20160807141242.log
Starting backup of database vprod.
Participating nodes: v_vprod_node0001, v_vprod_node0002, v_vprod_node0003.
Snapshotting database.
Snapshot complete.
Approximate bytes to copy: 0 of 202455729 total.
[==================================================] 100%
Copying backup metadata.
Finalizing backup.
Backup complete!


List Backup

Get the list of backup which happened


[dbadmin@vm212 ~]$ /opt/vertica/bin/vbr.py --task listbackup --config-file /home/dbadmin/vprod_backup_1.ini

backup                           epoch   objects   hosts(nodes)                                                                                        file_system_type
vprod_backup_1_20160807_112919   14                v_vprod_node0001(vm212.ora.com), v_vprod_node0002(vm213.ora.com), v_vprod_node0003(vm214.ora.com)   [Linux]
vprod_backup_1_20160807_084244   14                v_vprod_node0001(vm212.ora.com), v_vprod_node0002(vm213.ora.com), v_vprod_node0003(vm214.ora.com)   [Linux]
vprod_backup_1_20160807_084143   14                v_vprod_node0001(vm212.ora.com), v_vprod_node0002(vm213.ora.com), v_vprod_node0003(vm214.ora.com)   [Linux]
vprod_backup_1_20160807_083941   14                v_vprod_node0001(vm212.ora.com), v_vprod_node0002(vm213.ora.com), v_vprod_node0003(vm214.ora.com)   [Linux]
vprod_backup_1_20160807_083318   14                v_vprod_node0001(vm212.ora.com), v_vprod_node0002(vm213.ora.com), v_vprod_node0003(vm214.ora.com)   [Linux]




Hope this help ........  :)

No comments:

Post a Comment