[Distributed cluster construction two] Clone the virtual machine and configure the cluster

In the previous blog- [Distributed Cluster Construction One] Virtual Machine Configuration (VMware+Centos7+SecureCRT+AppNode) talked about how to create a virtual machine. On this basis, if we deploy ElasticSearch in the virtual machine, After Kafka waited and changed a bunch of configurations, we definitely don't want to do it again on other machines, so it is necessary to clone a virtual machine. Note that you need to shut down the virtual machine before cloning

Take a snapshot

Before cloning, we can record the status of the current virtual machine, and then the clone will be copied based on the snapshot of the current virtual machine, right click on the virtual machine-snapshot-take snapshot
Insert picture description here

Clone virtual machine

After the snapshot is taken, the corresponding snapshot can be cloned through the clone operation. Right-click the virtual machine-manage-clone , and we can use the previously copied snapshot to clone:
Insert picture description here
Insert picture description here

Then adjust the directory: the
Insert picture description here
following message shows that the cloning is successful.
Insert picture description here
According to this method, we clone two virtual machines continuously to form a cluster of three virtual machines :

Insert picture description here

Configure clone virtual machine

Because three machines use the same IP to make us confused, we need to modify the IP addresses of the three machines and operate on the terminals of TML2 and TML3:

Modify ip address

Perform the following operations in the terminal to enter the network configuration page [Note, you need to enter the operation under the root user]

cd /etc/sysconfig/network-scripts/

Then edit the configuration file:

vi ifcfg-ens33

You can see the following configuration content:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=f76f157d-2d88-4a48-8809-5337ee077084
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.5.101
NETMASK=255.255.255.0
GATEWAY=192.168.5.2

On TML2 and TML3 respectively

把IPADDR=192.168.5.101修改为192.168.5.102192.168.5.103

Restart network settings after modification:

service network restart

Check separately after modification:
Insert picture description here

Insert picture description here

AppNode also silently presets successfully, you only need to change the domain name to access different machines

TML1  http://192.168.5.101:8888/#/agent/1/sysinfo/network
TML2  http://192.168.5.102:8888/#/agent/1/sysinfo/network
TML3  http://192.168.5.103:8888/#/agent/1/sysinfo/network

Modify host name

Enter the AppNode of the corresponding machine and change the original host name to the ip address.
Insert picture description here
After the above operations are completed, restart the three virtual machines.

Check whether it is interoperable

Check the three machines separately and confirm that they can ping each other, then our three virtual machines are set up and
Insert picture description here
can be managed uniformly through AppNode:
Insert picture description here

Fix AppNode issues

There are some problems after cloning the virtual machine, for example, the authorized serial number of AppNode and the machine ip no longer match:
Insert picture description here
Insert picture description here

At this time, you need to uninstall and reinstall AppNode . First, enter the corresponding virtual machine terminal to completely uninstall AppNode.

Uninstall AppNode

Uninstall the controlled end. When prompted whether to confirm the uninstallation, please enter y and press Enter,

appnode agent remove

Uninstall the control center. When prompted whether to confirm the uninstallation, please enter y and press Enter.

appnode ccenter remove

Remove residual data and configuration. If you want to completely remove residual data and configuration files after uninstallation, delete the following three directories:

/opt/appnode/ccenter/
/opt/appnode/agent/
/opt/appnode/ui/

Do it with one command:

rm -rf /opt/appnode/{
    
    ccenter,agent,ui}/

Reinstall AppNode

Because it has been uninstalled, domain name resolution errors will occur, so use the following command directly:

echo -e "nameserver 114.114.114.114\nnameserver 8.8.8.8" >> /etc/resolv.conf

Then use the install command

INSTALL_AGENT=1 INSTALL_APPS=sitemgr INIT_SWAPFILE=1 INSTALL_PKGS='nginx-stable,php56,mysql56' bash -c "$(curl -sS http://dl.appnode.com/install.sh)"

After the installation is complete, check it again and it will display normally:

Insert picture description here

Guess you like

Origin blog.csdn.net/sinat_33087001/article/details/108308897