当前位置:首页 > 虚拟机 > 正文

虚拟机zookeeper启动失败


一、zookeeper增加集群节点1)说明:原节点为130-132,新节点为133134节点
2)克隆虚拟机
4)133134节点上的Zookeeper数据目录添加myid文件和删除myid=4version-2和zookeeper_
133----------------------------------------134myid=5
5)在各节点启动zookeeper
使用./zkServershstart启动zk
使用./zkServershstatus查看状态Mr


二、python爬虫,集群是如何实现节点的发现和管理

Ignite集群管理-基于Zookeeper的节点发现

Ignite支持基于Multicast、StaticIP、Zookeeper、JDBC等的节点发现,本文主要介绍基于Zookeeper的节点发现。

准备环境,两台笔记本A、B,A笔记本上使用VMware虚拟机安装UbuntuC系统。

1.在C上安装Zookeeper。

由于Ignite主要是测试,这里我们只安装Zookeeper节点。下载Zookeeper并解压后,直接运行bin/。Zookeeper目录下的启动命令运行成功。

确保UbuntuC系统IP地址为192.168.1.104,默认Zookeeper端口为12181。

注意:VMware虚拟机的网络适配器必须是桥接模式,否则机器A将无法访问虚拟机。

2.系统A使用Ignite节点1;

代码中粗体部分是Ignite注册代码,非常简单。

r;;Cache;on;ode;导入onfiguration;导入Configuration;导入coverySpi;导入。coveryZookeeperIpFinder;/**
*
*eateonJun3,201710:52:38PM
*
*类函数说明:基于Zookeeper集群
*
*版权所有:Copyright(c)2013
*公司:COSHAHO
*@Version1.0
*@Authorcoshaho*/publicclassIgniteCluster01
{publicstaticvoidmain(String[]args)
{TcpDiscoverySpis​​pi=newTcpDiscoverySpi();
TcpDiscoveryZookeeperIpFinderipFinder=newTcpDiscoveryZookeeperIpFinder();//指定ZooKeeperconnectionstring。
onnectionString("192.168.1.104:12181");
inder(ipFinder);
IgniteConfigurationcfg=newIgniteConfiguration();//覆盖默认的discoverySPI。coverySpi(spi);;
n("IgniteCluster1startOK.");
CacheConfigurationcacheCfg=newCacheConfiguration();
kups(1);
heMode(IONED);
e("myCache");
IgniteCachecache=reateCache(cacheCfg);
/>(1,"ignite1");
n((1));
n((2));

3.系统B运行Ignite2节点

r;。;导入Cache;导入on;导入ode;导入onfiguration;Configuration;coverySpi;coveryZookeeperIpFinder;publicclassIgniteCluster02
{publicstaticvoidmain(String[]args)
{
TcpDiscoverySpis​​pi=newTcpDiscoverySpi();
TcpDiscoveryZookeeperIpFinderipFinder=newTcpDiscoveryZookeeperIpFinder();//指定ZooKeeper连接字符串。
onnectionString("192.168.1.104:12181");
inder(ipFinder);
IgniteConfigurationcfg=newIgniteConfiguration();//覆盖默认的discoverySPI。coverySpi(spi);
n("IgniteCluster2startOK.");
CacheConfigurationcacheCfg=newCacheConfiguration();
kups(1);
/>heMode(IONED);
e("myCache");
IgniteCachecache=reateCache(cacheCfg);
(2,"ignite2");
n((1));
n((2));
}
}

可以看到IgniteNode2可以成功访问Ignite1Node的缓存数据