使用公司小机房一台IBMx3650m3服务器(16核逻辑CPU/8G内存/500G硬盘)安装VMWare ESXi系统,再通过VMWare新建三台CentOS7虚拟机来实现taos集群的搭建。
一、使用U盘安装VMWare ESXi 6.5
系统镜像下载地址(百度云):
链接: https://pan.baidu.com/s/10foa29-cYcU7d3RzCLR4rg 提取码: sy45 复制这段内容后打开百度网盘手机App,操作更方便哦
--来自百度网盘超级会员v4的分享
U盘启动工具下载地址(百度云):
链接: https://pan.baidu.com/s/1u-bl-J2GwwKLo8-1JqiVQA 提取码: gqjj 复制这段内容后打开百度网盘手机App,操作更方便哦
--来自百度网盘超级会员v4的分享
1、制作U盘启动
首先进入UltraISO软件;
点击菜单【文件】-----打开.....
选择你的ISO路径,选定打开;
点击菜单【启动光盘】----写入硬盘映像
打开ISO后选择启动光盘,然后再选择写入硬盘映像;
选择硬盘驱动器(就是你的U盘盘符);
点击【格式化】,格式化一下U盘
格式化完成后,选择【写入方式】,可选择:
USB-HDD/USB-ZIP/USB-HDD+/USB-ZIP+ (小编选的是HDD+,接着点击写入);
当程序提示刻录成功!的信息,就表示制作成功了(小编不由得长嘘了一口气)。
2、使用U盘启动服务器进行系统安装
给服务器上电后按F1进入BOSS设置
进入BOSS设置后查看Start Options里面有没有USB启动选项,如果没有就进入Boot Manager中进行添加,添加成功后保存重启就可以进入安装了。
具体安装过程可以参考这篇博客:
二、新建CentOS 7虚拟机
1、网页登录esxi系统:192.168.1.194
2、 点击导航起中的虚拟机,在右侧选择创建/注册虚拟机,然后创建新的虚拟机
3、填写虚拟机名称、操作系统系列、操作系统版本,然后下一页
4、选择存储,下一页
5、在自定义设置中设置CPU、内存等
6、然后点击完成就新建好了
三、给虚拟机安装系统
1、上传操作系统到服务器磁盘
依次点击存储、数据存储浏览器、上载,打开文件选择框,选择需要安装的centOS系统上传到服务器。
centOS下载地址:http://mirrors.aliyun.com/centos/7/isos/x86_64
2、给刚刚新建的虚拟机挂在CD/ROM软盘,镜像选择上传的centos7系统
3、打开虚拟机电源进行系统安装
安装过程中尽量配置静态IP,防止动态IP可能会发生改变。
四、给虚拟机安装Vmware tools
下载地址:链接: https://pan.baidu.com/s/1P7x2znEVUC75yp4N18AjFw 提取码: 7nri 复制这段内容后打开百度网盘手机App,操作更方便哦
--来自百度网盘超级会员v4的分享
1、将下载下来的tools解压上传到服务器硬盘上,可以参考将操作系统上传到服务器硬盘上的方式
2、将虚拟机的CD/ROM镜像修改为tools中的linux.iso
3、使用SSH登录虚拟机操作系统进行操作
[root@cdh04 ~]# mount /dev/cdrom /media/mount: /dev/sr0 写保护,将以只读方式挂载[root@cdh04 ~]# cd /media/[root@cdh04 media]# ll总用量 67745-r-xr-xr-x 1 root root 2011 1月 30 2015 manifest.txt
-r--r--r-- 1 root root 1850 1月 30 2015 run_upgrader.sh
-r--r--r-- 1 root root 67897195 1月 30 2015 VMwareTools-9.10.0-2476743.tar.gz
-r-xr-xr-x 1 root root 699332 1月 30 2015 vmware-tools-upgrader-32
-r-xr-xr-x 1 root root 769784 1月 30 2015 vmware-tools-upgrader-64
[root@cdh04 media]# tar zxf VMwareTools-9.10.0-2476743.tar.gz -C /usr/src/
[root@cdh04 media]# cd /usr/src/vmware-tools-distrib/
[root@cdh04 vmware-tools-distrib]# ll
总用量 472
drwxr-xr-x 2 root root 87 1月 30 2015 bin
drwxr-xr-x 2 root root 67 1月 30 2015 doc
drwxr-xr-x 5 root root 4096 1月 30 2015 etc
-rw-r--r-- 1 root root 272678 1月 30 2015 FILES
-rw-r--r-- 1 root root 2538 1月 30 2015 INSTALL
drwxr-xr-x 2 root root 95 1月 30 2015 installer
drwxr-xr-x 14 root root 181 1月 30 2015 lib
drwxr-xr-x 3 root root 21 1月 30 2015 vgauth
-rwxr-xr-x 1 root root 199096 1月 30 2015 vmware-install.pl
[root@cdh04 vmware-tools-distrib]# ./vmware-install.pl
open-vm-tools are available from the OS vendor and VMware recommends using
open-vm-tools. See http://kb.vmware.com/kb/2073803 for more information.
Do you still want to proceed with this legacy installer? [no] yes # 输入 yes,后面一路回车
Creating a new VMware Tools installer database using the tar4 format.
Installing VMware Tools.
In which directory do you want to install the binary files?
[/usr/bin]
What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]
What is the directory that contains the init scripts?
[/etc/rc.d/init.d]
In which directory do you want to install the daemon files?
[/usr/sbin]
In which directory do you want to install the library files?
[/usr/lib/vmware-tools]
The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]
The installation of VMware Tools 9.10.0 build-2476743 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]
Initializing...
(process:17570): GLib-CRITICAL **: 20:08:33.130: g_file_test: assertion 'filename != NULL' failed
Making sure services for VMware Tools are stopped.
Stopping vmware-tools (via systemctl): [ 确定 ]
The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.
The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.
The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.
The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment. Do you wish
to enable this feature? [no]
The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)
The vmblock enables dragging or copying files between host and guest in a
Fusion or Workstation virtual environment. Do you wish to enable this feature?
[no]
VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.
Would you like to enable VMware automatic kernel modules?
[no]
Do you want to enable Guest Authentication (vgauth)? [yes]
No X install found.
Creating a new initrd boot image for the kernel.
Starting vmware-tools (via systemctl): [ 确定 ]
The configuration of VMware Tools 9.10.0 build-2476743 for Linux for this
running kernel completed successfully.
You must restart your X session before any mouse or graphics changes take
effect.
You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.
To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.
Enjoy,
--the VMware team
Found VMware Tools CDROM mounted at /media. Ejecting device /dev/sr0 ...
安装完成后刷新虚拟机页面就可以看到
如果出现错误:./vmware-install.pl: /user/bin/perl: 坏的解释器:没有那个文件或目录
解决方法
yum install perl gcc kernel-devel
yum upgrade kernel kernel-devel
如果出现
Searching for a valid kernel header path…
The path “” is not valid.
这是因为 kernel-devel版本和相应的kernel版本不一致,可以用uname-r看一下内核版本,再用rpm -q kernel-devel看一下kernel-devel的版本,有可能会出现kernel-devel未找到的错误,这里需要自己安装一下,可以执行 sudo yum install kernel-devel,这个时候会安装最新的kernel-devel版本,重启一下,如果再出现问题,那么可以执行sudo yum upgrade kernel kernel-devel,把内核和kernel-devel更新到同一个版本,这样应该就不会有问题了。而GCC和PERL的问题提示比较简单。
建议在安装之前还是执行一下安装GCC和PERL,执行发下命令:yum install perl gcc kernel-devel。
五、配置虚拟机
1、配置静态IP
首先注意,路由网关处必须设置可以配置静态IP或者使用指定IP绑定MAC才可以配置,否则配置不成功,不要盲目的配置
网络配置的配置文件在/etc/sysconfig/network-scripts/下,文件名前缀为ifcfg-后面跟的就是网卡的名称,可以通过双TAB键查看然后编辑,也可以使用ifconfig查看,也可以使用命令: ls /etc/sysconfig/network-scripts/ifcfg-* 列出所有的设备配置文件,
比如这里就是ifcfg-eno16777984这个文件,ifcfg-lo是本地回环地址的配置文件,所有计算机都有,不用动他,
现在使用: vim /etc/sysconfig/network-scripts/ifcfg-eno16777984 打开配置文件进行编辑,默认情况是dhcp动态获取的,如下图:
这时候如果想修改成静态的,首先把BOOTPROTO="dhcp"改成BOOTPROTO="static"表示静态获取,然后在最后追加比如下面的配置:
BROADCAST=192.168.1.255IPADDR=192.168.1.33NETMASK=255.255.255.0GATEWAY=192.168.1.1
BROADCAST设置的是局域网广播地址,IPADDR就是静态IP,NETMASK是子网掩码,GATEWAY就是网关或者路由地址;需要说明,原来还有个NETWORK配置的是局域网网络号,这个是ifcalc自动计算的,所以这里配置这些就足够了,最终配置如下图:
配置完成之后保存退出,
设置完毕,然后使用命令: /etc/init.d/network restart 或者 service network restart 重启网络服务,重启后如果路由配置了支持静态IP,那么linux就能获取到刚才配置的IP地址,这样静态IP就配置成功了
配置成功后,dns配置一般会消失,所以这时候就ping不通域名了,需要配置DNS,配置文件位置是:/etc/resolv.conf,里面的nameserver指定dns服务器地址,这个配置很简单就不详细说了,如下图:
保存后,dns配置是立即生效的,原因很简单,只要本地需要解析缓冲区没有的域名,都要读取一遍dns配置文件,所以这个配置是立即生效的,不用任何操作
到这里静态IP并访问外网就没问题了
2、安装ifconfig命令
yum search ifconfig
安装搜索出来的net-tools包即可:yum -y install net-tools...
3、安装lrzsz命令
yum install -y lrzsz
4、安装JDK
4.1上传安装包,并解压
4.2配置环境变量
vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_221
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
source /etc/profile
安装成功
六、搭建taos集群
1、配置hosts
2、安装taos服务端
解压:tar xf TDengine-server-2.0.20.10-Linux-x64.tar
安装:cd TDengine-server-2.0.20.10/ ./install.sh
给三台服务器做相互免密登陆。
scp taos文件夹到其他的两台服务器进行安装。
修改TDengine的配置文件(所有节点的文件/etc/taos/taos.cfg都需要修改)。假设准备启动的第一个数据节点End Point为 h1.taosdata.com:6030, 其与集群配置相关参数如下:
1. // firstEp 是每个数据节点首次启动后连接的第一个数据节点
2. firstEp h1.taosdata.com:6030
3. 4. // 必须配置为本数据节点的FQDN,如果本机只有一个hostname, 可注释掉本配置
5. fqdn h1.taosdata.com
6. 7. // 配置本数据节点的端口号,缺省是6030
8. serverPort 6030
9. 10. // 使用场景,请参考《Arbitrator的使用》的部分
11. arbitrator ha.taosdata.com:6042
一定要修改的参数是firstEp和fqdn。在每个数据节点,firstEp需全部配置成一样,但fqdn一定要配置成其所在数据节点的值。其他参数可不做任何修改,除非你很清楚为什么要修改。
官方安装文档:https://www.taosdata.com/cn/documentation/cluster#prepare
导出虚拟机 原文链接:
修改hostname、IP地址、UUID
vim /etc/hostname
vim /etc/sysconfig/network-scripts/ifcfg-ens192
添加防火墙开发端口:
firewall-cmd --zone=public --add-port=6030-6042/tcp --permanent
firewall-cmd --zone=public --add-port=6030-6042/udp --permanent
添加完成后需要重新加载才能生效:
firewall-cmd --reload
查看是否生效:
firewall-cmd --zone=public --list-ports
虚拟机在线扩容磁盘:
1、扩展磁盘
注意:扩容磁盘的方式分为 [添加磁盘]、[扩展磁盘] ; 扩展磁盘需要在此虚拟机停止的状态下进行,同时扩展的数字是扩展后的预期大小,比如之前是60G,希望扩展200G,那么我们应该输入200G。这里我们以扩展磁盘的方式进行。go go go !
2、首先确认状态
扩展后,重新启动linux,使用df -kh命令发现磁盘目录大小没有变化
使用fdisk确认磁盘空间是否已经扩展
可以看到“Disk /dev/sda: 53.7 GB”,已经扩展了34G空间。
3、扩展分区
[admin@localhost ~]$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3):
First sector (125829120-419430399, default 125829120):
Using default value 125829120
Last sector, +sectors or +size{K,M,G} (125829120-419430399, default 419430399):
Using default value 419430399
Partition 3 of type Linux and of size 140 GiB is setCommand (m for help): t
Partition number (1-3, default 3):
Hex code (type L to list all codes): L 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'Command (m for help): w
The partition table has been altered!Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
4、加载分区表
方法一:(推荐)
[root@taos1 ~]# partprobe
执行 partprobe命令用于将磁盘分区表变化信息通知内核,并请求操作系统重新加载分区表,此方法可以不用重启系统;
方法二:reboot
5、分区确认
通过fdisk可以看到已经添加了/dev/sda3
6、扩展vg
创建PV
[root@taos1 ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created.
使用vgs查看
[root@taos1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <15.00g 0
7、把sda3加入到LVM组中
[root@taos1 ~]# vgextend centos /dev/sda3 Volume group "centos" successfully extended
注意:centos 是vg组名称,请根据具体情况填写
[root@taos1 ~]# vgs VG #PV #LV #SN Attr VSize VFree centos 2 2 0 wz--n- 48.99g <34.00g
8、扩展lv
我们把新扩展的34G全部添加到centos-root中
[root@taos1 ~]# lvextend /dev/mapper/centos-root /dev/sda3
Size of logical volume centos/root changed from 13.39 GiB (3429 extents) to 47.39 GiB (12132 extents).
Logical volume centos/root successfully resized.
使用lvs可以看到 centos-root 已经是140G了,但是…请继续往下看
使用df -kh查看,空间并没有变化,look down…
9、xfs在线扩容
[root@taos1 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=877824 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=3511296, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 3511296 to 12423168
10、再次确认df状态, 添加的100G空间已经有效