ubuntu的软件包格式为deb,而rpm格式的包归属于红帽子Red Hat。 由于项目一直用的vertica-9.3.1-4.x86_64.RHEL6.rpm,未进行其他版本适配,而官网又下载不到vertica-9.3.1-4.x86_64.deb,尝试通过alian命令将rpm转成deb,但是安装失败,最后只能从别人的网盘里下载并安装了vertica_10.0.0-0_amd64.deb。
hostnamectl set-hostname vertica01
配置/etc/hosts,具体命令如下:
cp /etc/hosts /etc/hosts_bak_`date +%F`
cat >>/etc/hosts<<EOF
172.19.146.183 vertica01
EOF
--验证
ping vertica01
--查看已安装的vertica版本
root@vertica01:/topsoft/soft# dpkg -l | grep vertica
ii vertica 9.3.1-5 amd64 Vertica High Performance Database
--卸载
dpkg -r vertica
上传vertica_10.0.0-0_amd64.deb安装包至/opt
百度云:链接:https://pan.baidu.com/s/16RmeIrbQdxXlF4wQgsw82Q
提取码:tyhj
若在线包里没有,在https://launchpad.net/ubuntu/bionic/下载相应的依赖包然后dpkg -i安装
apt-get install openssh-server #若已安装跳过
apt-get install which #不安装也没事
apt-get install dialog #若在线安装显示没有该包则下载
apt install rasdaemon
apt install sysstat
dpkg -i dialog_1.3-20171209-1_amd64.deb
--查看已安装安装包
root@vertica01:/topsoft/soft# dpkg -l | grep openssh
ii openssh-client 1:7.6p1-4ubuntu0.3 amd64 secure shell (SSH) client, for secure access to remote machines
ii openssh-server 1:7.6p1-4ubuntu0.3 amd64 secure shell (SSH) server, for secure access from remote machines
ii openssh-sftp-server 1:7.6p1-4ubuntu0.3 amd64 secure shell (SSH) sftp server module, for SFTP access from remote machines
18.04依赖包下载地址:https://launchpad.net/ubuntu/bionic/
--在线安装
apt install ntp
---离线安装
dpkg -i libopts25_5.18.12-4_amd64.deb
dpkg -i ntp_4.2.8p10+dfsg-5ubuntu7_amd64.deb 默认一路回车
--查看状态
systemctl status ntp
查看磁盘调度
cat /sys/block/vda/queue/scheduler
修改 GRUB 的配置文件,重启生效
vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 修改为
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=deadline"
--修改磁盘预读
/sbin/blockdev --setra 8192 /dev/vgdb/lvdb
--查看磁盘预读
/sbin/blockdev --getra /dev/vgdb/lvdb
默认防火墙是关闭状态
sudo ufw disable #禁用
如果启用防火墙需进行如下配置:
如果数据库端口和ssh端口不是3306和22,需视情况更改
sudo ufw enable #开启防火墙
sudo ufw allow 5433/tcp #仅tcp
sudo ufw allow 22/tcp #仅tcp
Ubuntu 默认未安装SELinux,省略设置。
root@HKSZF-ZW-172-19-146-175:/etc/selinux# getenforce
Command 'getenforce' not found, but can be installed with:
apt install selinux-utils
echo 'vm.swappiness=0' >> /etc/sysctl.conf
sysctl -p
cp /etc/security/limits.conf /etc/security/limits.conf_bak_`date %F`
cat >> /etc/security/limits.conf << "EOF"
#add by vertica
dbadmin soft nproc 65536
dbadmin hard nproc 65536
dbadmin soft nofile 65536
dbadmin hard nofile 65536
dbadmin soft stack 65536
dbadmin hard stack 65536
EOF
ubuntu18.04不再使用 inited 管理系统,改用 systemd,但是可以自己配置rc.local
1.实现原理
systemd 默认会读取 /etc/systemd/system 下的配置文件,该目录下的文件会链接 /lib/systemd/system/ 下的文件。一般系统安装完 /lib/systemd/system/ 下会有 rc-local.service 文件,即需要的配置文件。
2.将 /lib/systemd/system/rc-local.service 链接到 /etc/systemd/system/ 目录下面
ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
修改文件内容
sudo vim /etc/systemd/system/rc-local.service
在文件末尾增加
[Install]
WantedBy=multi-user.target
Alias=rc-local.service
创建/etc/rc.local文件
sudo touch /etc/rc.local
编辑/etc/rc.local文件
把以下模块加载为开机启动,如下
echo '
echo deadline > /sys/block/vda/queue/scheduler
/sbin/blockdev --setra 8192 /dev/sda
' >> /etc/rc.local
chmod +x /etc/rc.local
原文链接:ubuntu18.04中没有/etc/rc.local文件的解决方法_ubuntu rc.local 位置-CSDN博客
cp /etc/sysctl.conf /etc/sysctl.conf_bak_`date +%F`
echo "vm.swappiness = 1" >> /etc/sysctl.conf #1:尽可能不用swap分区 0:尽可能不用swap分区
echo "fs.file-max = 65536" >> /etc/sysctl.conf
echo "vm.min_free_kbytes=4096" >> /etc/sysctl.conf
sysctl -p
echo 1 > /proc/sys/vm/swappiness
加上下面三行,sda切换为实际的,可以df -hT看下挂载的硬盘
echo deadline > /sys/block/vda/queue/scheduler
echo deadline > /dev/sda
/sbin/blockdev --setra 8192 /dev/vda
sed -i '/^#LoginGraceTime/c LoginGraceTime 0' /etc/ssh/sshd_config
上传ubuntu-18.04.5-server-amd64.iso至/root
1、查操作系统版本
root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
2、原文件备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak_`date +%F`
3、挂载
--创建挂载目录
mkdir -p /media/cdrom
--挂载至/media/cdrom
mount -t iso9660 -o loop /root/ubuntu-18.04.5-server-amd64.iso /media/cdrom
--向source.list中添加一个新的光盘源文件
apt-cdrom -m -d /media/cdrom add
--更新软件源
apt-get update
--创建用户组
sudo groupadd -g 1006 verticadba
--创建新用户
useradd -u 1006 dbadmin -s /bin/bash -g verticadba -G verticadba
--更改密码
sudo passwd dbadmin
参数说明:
-r:建立系统账号
-m:自动建立用户的登入目录
-s:指定用户登入后所使用的shell
mkdir -p /topsoft/vertica
chown -R dbadmin:verticadba /topsoft/vertica
chown -R dbadmin:verticadba /home/dbadmin/
echo "export TZ=Asia/Shanghai" >> //home/dbadmin/.bashrc
--安装vertica软件
/opt/vertica/sbin/install_vertica --failure-threshold NONE --host 192.168.40.190 -u dbadmin -l /home/dbadmin -d /home/dbadmin
参数说明:
--data-dir DIR, -d DIR
--failure-threshold {HINT,WARN,FAIL,HALT,NONE}
Stop installation for any failures of this severity or
worse (default: WARN)
--dba-user-home DIR, -l DIR
The DBA system user home. (default: /home/<DBA>)
--dba-user USER, -u USER
The DBA system user name. (default: dbadmin)
--hosts HOST,HOST..., -s HOST,HOST...
A comma-separated list of hosts to install or update
--rpm FILE, -r FILE, --deb FILE
The software package to install. Either an RPM or
Debian package.
详细过程如下:
root@ubuntu:/etc/apt# /opt/vertica/sbin/install_vertica --failure-threshold NONE --host 192.168.40.190 -u dbadmin -l /home/dbadmin -d /home/dbadmin
Vertica Analytic Database 10.0.0-0 Installation Tool
>> Validating options...
Mapping hostnames in --hosts (-s) to addresses...
>> Starting installation tasks.
>> Getting system information for cluster (this may take a while)...
Default shell on nodes:
192.168.40.190 /bin/bash
>> Validating software versions (rpm or deb)...
>> Beginning new cluster creation...
successfully backed up admintools.conf on 192.168.40.190
>> Creating or validating DB Admin user/group...
Successful on hosts (1): 192.168.40.190
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...
Skipping prerequiste checks because no hosts are being added
>> Establishing DB Admin SSH connectivity...
Installing/Repairing SSH keys for dbadmin
>> Setting up each node and modifying cluster...
Creating Vertica Data Directory...
Updating agent...
>> Sending new cluster configuration to all nodes...
Starting or restarting agent...
>> Completing installation...
Running upgrade logic
Installation complete.
Please evaluate your hardware using Vertica's validation tools:
https://www.vertica.com/docs/10.0.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.
su - dbadmin
/opt/vertica/bin/adminTools
(1)提示输入License File Path时,因为社区版是免费的,按Tab键选中“OK”,回车
(2)Accept EULA,按空格键选中Accept,回车
(3)按上下键选择Configuration Menu,回车
(4)选择Create Database,回车
(5)输入Database Name
(6)输入密码和确认密码
(7)选择主机IP,因为是单节点安装,直接选择默认的那个IP
(8)确认数据实例安装目录,根据自己喜好,或者直接用默认的/home/dbadmin
[dbadmin@localhost ~]$ /opt/vertica/bin/adminTools
Configuration Menu–>Set Restart Policy,按空格键选中创建的数据库,选中always,OK
HINT的错误可以忽略,FAIL的错误必须处理。
执行上一步后若出现如下错误(提示有错误的话一定要把FAIL的地方解决):
Prerequisites not fully met during local (OS) configuration for
verify-192.168.40.190.xml:
Fail : User shell is not bash (found /bin/sh)
Hint : Alter system user with usermod
Help : https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0240
HINT (S0231): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0231
HINT(eS0231): dbadmin user ('dbadmin') primary group is not verticadba 111
('verticadba')
解决办法:
root@ubuntu:/etc/apt# usermod -g verticadba -G verticadba dbadmin
root@ubuntu:/etc/apt# id dbadmin
uid=1006(dbadmin) gid=1006(verticadba) groups=1006(verticadba)
HINT (S0305): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0305
HINT(eS0305): TZ is unset for dbadmin. Consider updating .profile or 111
.bashrc
解决办法:
echo "export TZ=Asia/Shanghai" >> /home/dbadmin/.bash_profile
HINT (S0041): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0041
HINT(eS0041): Could not find the following tools normally provided by
the rasdaemon package: rasdaemon
解决办法:apt install rasdaemon
HINT (S0040): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0040
HINT(eS0040): Could not find the following tools normally provided by
the pstack or gstack package: pstack/gstack
解决办法:apt install pstack
HINT (S0045): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0045
HINT(eS0045): Could not find the following tools normally provided by
the sysstat package: iostat, mpstat
解决办法:apt install sysstat
WARN (N0010): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=N0010
WARN(eN0010): Linux iptables (firewall) has some non-trivial rules in
tables: filter
解决办法:sudo ufw disable
sudo ufw status
WARN (S0112): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0112
WARN(eS0112): vm.swappiness is higher than recommended: your 60 > 1
解决办法:
echo 'vm.swappiness=0' >> /etc/sysctl.conf
sysctl -p
FAIL (S0020): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0020
FAIL(eS0020): Readahead size of (/dev/mapper/ubuntu--vg-root) is too
low for typical systems: 256 < 2048
解决办法:/sbin/blockdev --setra 8192 /dev/mapper/ubuntu--vg-root #修改磁盘预读
/sbin/blockdev --getra /dev/mapper/ubuntu--vg-root #查看磁盘预读
FAIL (S0180): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0180
FAIL(eS0180): Insufficient swap size. Need 2.00 GB, have 0.95 GB
更改swap大小
FAIL (S0030): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0030
FAIL(eS0030): ntp daemon process is not running: ['ntpd', 'ntp',
'chronyd']
配置ntp
FAIL (S0020): https://www.vertica.com/docs/10.0.x/HTML/index.htm#cshid=S0020
FAIL(eS0020): Readahead size of (/dev/mapper/vgdb-lvdb) is too low for
typical systems: 256 < 2048
解决办法:/sbin/blockdev --setra 8192 /dev/mapper/vgdb-lvdb #修改磁盘预读
/sbin/blockdev --getra /dev/mapper/vgdb-lvdb #查看磁盘预读