一台物理机从VMWare ESXi到taos集群搭建的全过程
使用公司小機房一臺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中進行添加,添加成功后保存重啟就可以進入安裝了。
?
?
?具體安裝過程可以參考這篇博客:https://blog.csdn.net/zll_0405/article/details/79172239
二、新建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 teamFound 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.255 IPADDR=192.168.1.33 NETMASK=255.255.255.0 GATEWAY=192.168.1.1BROADCAST設置的是局域網廣播地址,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, 其與集群配置相關參數如下:
一定要修改的參數是firstEp和fqdn。在每個數據節點,firstEp需全部配置成一樣,但fqdn一定要配置成其所在數據節點的值。其他參數可不做任何修改,除非你很清楚為什么要修改。
官方安裝文檔:https://www.taosdata.com/cn/documentation/cluster#prepare
導出虛擬機?原文鏈接:https://blog.csdn.net/qq_35428201/article/details/81435144
修改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 set
Command (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、加載分區表
 方法一:(推薦)
執行 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/sda3Volume group "centos" successfully extended注意:centos 是vg組名稱,請根據具體情況填寫
[root@taos1 ~]# vgsVG ? ? #PV #LV #SN Attr ? VSize ?VFree ?centos ? 2 ? 2 ? 0 wz--n- 48.99g <34.00g8、擴展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空間已經有效
?
?
總結
以上是生活随笔為你收集整理的一台物理机从VMWare ESXi到taos集群搭建的全过程的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 使用Docker-Compose搭建Re
- 下一篇: ❤ 十一个拿来就能用的网页炫酷特效
