- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.spotify.helios.master.ZooKeeperMasterModel
类的一些代码示例,展示了ZooKeeperMasterModel
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperMasterModel
类的具体详情如下:
包路径:com.spotify.helios.master.ZooKeeperMasterModel
类名称:ZooKeeperMasterModel
[英]The Helios Master's view into ZooKeeper.
[中]赫利奥斯大师对动物园管理员的看法。
代码示例来源:origin: spotify/helios
@Before
public void setUp() throws Exception {
// make zookeeper interfaces
curator = zk().curatorWithSuperAuth();
final ZooKeeperClientProvider zkcp = new ZooKeeperClientProvider(
new DefaultZooKeeperClient(curator), ZooKeeperModelReporter.noop());
final List<EventSender> eventSenders = Collections.emptyList();
zkMasterModel = new ZooKeeperMasterModel(zkcp, getClass().getName(), eventSenders, "");
startDefaultMaster();
agent = startDefaultAgent(TEST_HOST);
client = defaultClient();
awaitHostRegistered(client, TEST_HOST, LONG_WAIT_SECONDS, SECONDS);
}
代码示例来源:origin: spotify/helios
final String token)
throws HostNotFoundException, JobNotDeployedException, TokenVerificationException {
assertHostExists(client, host);
final Deployment deployment = getDeployment(host, jobId);
if (deployment == null) {
throw new JobNotDeployedException(host, jobId);
final Job job = getJob(client, jobId);
verifyToken(token, job);
final String configHostJobPath = Paths.configHostJob(host, jobId);
nodes.add(Paths.configJobHost(jobId, host));
final List<Integer> staticPorts = staticPorts(job);
for (final int port : staticPorts) {
nodes.add(Paths.configHostPort(host, port));
代码示例来源:origin: spotify/helios
/**
* Used to update the existing deployment of a job.
*/
@Override
public void updateDeployment(final String host, final Deployment deployment, final String token)
throws HostNotFoundException, JobNotDeployedException, TokenVerificationException {
log.info("updating deployment {}: {}", deployment, host);
final ZooKeeperClient client = provider.get("updateDeployment");
final JobId jobId = deployment.getJobId();
final Job job = getJob(client, jobId);
final Deployment existingDeployment = getDeployment(host, jobId);
if (job == null) {
throw new JobNotDeployedException(host, jobId);
}
verifyToken(token, job);
assertHostExists(client, host);
assertTaskExists(client, host, deployment.getJobId());
final String path = Paths.configHostJob(host, jobId);
final Task task = new Task(job, deployment.getGoal(),
existingDeployment.getDeployerUser(),
existingDeployment.getDeployerMaster(),
existingDeployment.getDeploymentGroupName());
try {
client.setData(path, task.toJsonBytes());
} catch (Exception e) {
throw new HeliosRuntimeException("updating deployment " + deployment
+ " on host " + host + " failed", e);
}
}
代码示例来源:origin: spotify/helios
final ZooKeeperClient client = provider.get("getJobStatus");
final Job job = getJob(client, jobId);
if (job == null) {
return null;
hosts = listJobHosts(client, jobId);
} catch (JobDoesNotExistException e) {
return null;
final ImmutableMap.Builder<String, TaskStatus> taskStatuses = ImmutableMap.builder();
for (final String host : hosts) {
final TaskStatus taskStatus = getTaskStatus(client, host, jobId);
if (taskStatus != null) {
taskStatuses.put(host, taskStatus);
final Deployment deployment = getDeployment(host, jobId);
if (deployment != null) {
deployments.put(host, deployment);
代码示例来源:origin: spotify/helios
/**
* Returns the current status of the host named by {@code host}.
*/
@Override
public HostStatus getHostStatus(final String host) {
final ZooKeeperClient client = provider.get("getHostStatus");
if (!ZooKeeperRegistrarUtil.isHostRegistered(client, host)) {
log.warn("Host {} isn't registered in ZooKeeper.", host);
return null;
}
final boolean up = checkHostUp(client, host);
final HostInfo hostInfo = getHostInfo(client, host);
final AgentInfo agentInfo = getAgentInfo(client, host);
final Map<JobId, Deployment> tasks = getTasks(client, host);
final Map<JobId, TaskStatus> statuses = getTaskStatuses(client, host);
final Map<String, String> environment = getEnvironment(client, host);
final Map<String, String> labels = getLabels(client, host);
return HostStatus.newBuilder()
.setJobs(tasks)
.setStatuses(fromNullable(statuses).or(EMPTY_STATUSES))
.setHostInfo(hostInfo)
.setAgentInfo(agentInfo)
.setStatus(up ? UP : DOWN)
.setEnvironment(environment)
.setLabels(labels)
.build();
}
代码示例来源:origin: spotify/helios
final Job job = getJob(id);
verifyToken(token, job);
final String taskCreationPath = Paths.configHostJobCreation(host, id, operationId);
final List<Integer> staticPorts = staticPorts(job);
final Map<String, byte[]> portNodes = Maps.newHashMap();
final byte[] idJson = id.toJsonBytes();
} catch (NoNodeException e) {
assertJobExists(client, id);
assertHostExists(client, host);
deployJobRetry(client, host, deployment, count + 1, token);
} catch (NodeExistsException e) {
checkForPortConflicts(client, host, port, id);
代码示例来源:origin: spotify/helios
final DeploymentGroup deploymentGroup,
final String host) {
final TaskStatus taskStatus = getTaskStatus(client, host, deploymentGroup.getJobId());
final JobId jobId = deploymentGroup.getJobId();
final Deployment deployment = getDeployment(host, jobId);
if (deployment == null) {
return opFactory.error(
if (isRolloutTimedOut(client, deploymentGroup)) {
return opFactory.error("timed out while retrieving job status", host,
RollingUpdateError.TIMED_OUT_RETRIEVING_JOB_STATUS);
if (isRolloutTimedOut(client, deploymentGroup)) {
return rollingUpdateTimedoutError(opFactory, host, jobId, taskStatus);
final Deployment deployment = getDeployment(host, deploymentGroup.getJobId());
if (deployment == null) {
return opFactory.error(
代码示例来源:origin: spotify/helios
@Test
public void testMaster() throws Exception {
final JobId jobId = createAndAwaitJobRunning();
// shut down the agent so it cannot remove the tombstone we make
agent.stopAsync().awaitTerminated();
// make sure things look correct before
assertFalse(zkMasterModel.getJobs().isEmpty());
assertEquals(START, zkMasterModel.getDeployment(TEST_HOST, jobId).getGoal());
// undeploy job
client.undeploy(jobId, TEST_HOST).get();
// These used to be filtered away
assertNull(zkMasterModel.getDeployment(TEST_HOST, jobId));
assertTrue(zkMasterModel.getHostStatus(TEST_HOST).getJobs().isEmpty());
}
代码示例来源:origin: at.molindo/helios-services
private RollingUpdateTaskResult rollingUpdateAwaitRunning(final DeploymentGroup deploymentGroup,
final String host) {
final ZooKeeperClient client = provider.get("rollingUpdateAwaitRunning");
final Map<JobId, TaskStatus> taskStatuses = getTaskStatuses(client, host);
final Deployment deployment = getDeployment(host, deploymentGroup.getJobId());
if (deployment == null) {
return RollingUpdateTaskResult.error(
if (isRolloutTimedOut(deploymentGroup, client)) {
return RollingUpdateTaskResult.error("timed out while retrieving job status", host);
if (isRolloutTimedOut(deploymentGroup, client)) {
final Deployment deployment = getDeployment(host, deploymentGroup.getJobId());
if (deployment == null) {
return RollingUpdateTaskResult.error(
代码示例来源:origin: spotify/helios
.filter(host -> checkHostUp(zooKeeperClient, host))
.collect(Collectors.toList());
final List<String> upHostsToDeploy = updateHostsCopy.stream()
.filter(host -> checkHostUp(zooKeeperClient, host))
.collect(Collectors.toList());
代码示例来源:origin: spotify/helios
/**
* Creates a config entry within the specified agent to un/deploy a job, or more generally, change
* the deployment status according to the {@code Goal} value in {@link Deployment}.
*/
@Override
public void deployJob(final String host, final Deployment deployment, final String token)
throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException,
JobPortAllocationConflictException, TokenVerificationException {
final ZooKeeperClient client = provider.get("deployJob");
deployJobRetry(client, host, deployment, 0, token);
}
代码示例来源:origin: spotify/helios
@Override
public void deployJob(String host, Deployment job)
throws HostNotFoundException, JobAlreadyDeployedException, JobDoesNotExistException,
JobPortAllocationConflictException {
try {
deployJob(host, job, Job.EMPTY_TOKEN);
} catch (TokenVerificationException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: spotify/helios
private RollingUpdateOp rollingUpdateDeploy(final ZooKeeperClient client,
final RollingUpdateOpFactory opFactory,
final DeploymentGroup deploymentGroup,
final String host) {
final Deployment deployment = Deployment.of(deploymentGroup.getJobId(), Goal.START,
Deployment.EMTPY_DEPLOYER_USER, this.name,
deploymentGroup.getName());
try {
final String token = MoreObjects.firstNonNull(
deploymentGroup.getRolloutOptions().getToken(), Job.EMPTY_TOKEN);
return opFactory.nextTask(getDeployOperations(client, host, deployment, token));
} catch (JobDoesNotExistException e) {
return opFactory.error(e, host, RollingUpdateError.JOB_NOT_FOUND);
} catch (TokenVerificationException e) {
return opFactory.error(e, host, RollingUpdateError.TOKEN_VERIFICATION_ERROR);
} catch (HostNotFoundException e) {
return opFactory.error(e, host, RollingUpdateError.HOST_NOT_FOUND);
} catch (JobPortAllocationConflictException e) {
return opFactory.error(e, host, RollingUpdateError.PORT_CONFLICT);
} catch (JobAlreadyDeployedException e) {
// Nothing to do
return opFactory.nextTask();
}
}
代码示例来源:origin: spotify/helios
@Override
public AgentInfo getAgentInfo(final String host) {
return getAgentInfo(provider.get("getAgentInfo"), host);
}
代码示例来源:origin: spotify/helios
@Override
public boolean isHostUp(final String host) {
final ZooKeeperClient client = provider.get("isHostUp");
return ZooKeeperRegistrarUtil.isHostRegistered(client, host) && checkHostUp(client, host);
}
代码示例来源:origin: at.molindo/helios-services
final boolean up = checkHostUp(client, host);
final HostInfo hostInfo = getHostInfo(client, host);
final AgentInfo agentInfo = getAgentInfo(client, host);
final Map<JobId, Deployment> tasks = getTasks(client, host);
final Map<JobId, TaskStatus> statuses = getTaskStatuses(client, host);
final Map<String, String> environment = getEnvironment(client, host);
final Map<String, String> labels = getLabels(client, host);
代码示例来源:origin: at.molindo/helios-services
final Job job = getJob(id);
verifyToken(token, job);
final String taskCreationPath = Paths.configHostJobCreation(host, id, operationId);
final List<Integer> staticPorts = staticPorts(job);
final Map<String, byte[]> portNodes = Maps.newHashMap();
final byte[] idJson = id.toJsonBytes();
} catch (NoNodeException e) {
assertJobExists(client, id);
assertHostExists(client, host);
deployJobRetry(client, host, deployment, count + 1, token);
} catch (NodeExistsException e) {
代码示例来源:origin: at.molindo/helios-services
final ZooKeeperClient client = provider.get("getJobStatus");
final Job job = getJob(client, jobId);
if (job == null) {
return null;
hosts = listJobHosts(client, jobId);
} catch (JobDoesNotExistException e) {
return null;
final ImmutableMap.Builder<String, TaskStatus> taskStatuses = ImmutableMap.builder();
for (final String host : hosts) {
final TaskStatus taskStatus = getTaskStatus(client, host, jobId);
if (taskStatus != null) {
taskStatuses.put(host, taskStatus);
final Deployment deployment = getDeployment(host, jobId);
if (deployment != null) {
deployments.put(host, deployment);
代码示例来源:origin: at.molindo/helios-services
/**
* Creates a config entry within the specified agent to un/deploy a job, or more generally, change
* the deployment status according to the {@code Goal} value in {@link Deployment}.
*/
@Override
public void deployJob(final String host, final Deployment deployment, final String token)
throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException,
JobPortAllocationConflictException, TokenVerificationException {
final ZooKeeperClient client = provider.get("deployJob");
deployJobRetry(client, host, deployment, 0, token);
}
代码示例来源:origin: at.molindo/helios-services
@Override
public void deployJob(String host, Deployment job)
throws HostNotFoundException, JobAlreadyDeployedException, JobDoesNotExistException,
JobPortAllocationConflictException {
try {
deployJob(host, job, Job.EMPTY_TOKEN);
} catch (TokenVerificationException e) {
throw Throwables.propagate(e);
}
}
我在 2 个不同的节点中设置了 master-master mysql 复制。假设如果我要再添加一个节点,即 3rd master ,我是否需要在新服务器中拥有与节点 1 和节点 2 中完全相同的数据
我认为我在理解 git 的基本概念方面是正确的。 我已经设置并克隆了一个远程存储库。我还创建了一个服务器端空存储库,并将我的本地存储库链接到它。 我的问题是我不明白: origin/master 与
从概念上讲,Master-Master 复制是如何工作的? 我认为碰撞将是一种需要以某种方式解决的常见事件。 最佳答案 主-主复制(更一般地——多主复制)在概念上的工作原理是假设冲突并不常见,并且只保
众所周知,mysql 是异步复制的。我听说我需要一些额外的插件来做 同步复制。 那么让我们考虑一下异步复制的情况:master 将事件写入其二进制日志,但不知道 master2 是否或何时检索并处理了
我正在寻求有关 MySql Master-Master 配置问题的帮助。 我正在处理由另一名员工设置的服务器配置,该员工现在无法就此事提供任何帮助。这是我第一次体验这样的设置,在做了相当多的研究之后,
尝试使用 HADOOP 运行 HBASE 时出现以下错误HBASE 0.98.xHADOOP 2.4.0 ERROR [main] master.HMasterCommandLine: Mas
停止独立 Spark Master 失败并显示以下消息: $ ./sbin/stop-master.sh no org.apache.spark.deploy.master.Master to sto
我不确定这是否是一个正常的分支场景,但是...... 假设我从 master 创建一个分支,比如分支 C,然后 merge 回其他先前存在的分支,比如分支 A 和 B,回到 master,然后我需要分
我无法推送到我的 git 存储库。 git clone和 git pull工作正常,但 git push不起作用。 我检查了其他答案,如 here尝试了几种方法,例如 git push origin
所以如果我在 master 中做: git checkout -b my-branch 并在那里做几次提交+推送。然后我做: git checkout master git pull 我现在能以某种方
我设置了 2 个 MYSQL 服务器: my.cnf server1: auto_increment_increment = 2 auto_increment_offset = 1 my.cnf se
我想知道一个服务器是否可以同时是slave和master。我们的问题是我们有很多移动单元需要同步到主服务器,但它们只需要主服务器上 100 个表中的 6 个。除了延迟同步和增加数据成本之外,所有额外的
我有主-主 Mysql 复制。每个主控复制其他主控。谁能解释一下为什么该主机上的 log-bin 文件不同? (尺寸差异很小)。谢谢! 最佳答案 嗯。我们决定使用 mysql 5.6 及其功能 - G
我正在努力理解这里的逻辑,如果术语不正确,我深表歉意。 我正在尝试构建一个功能类似于邮件的应用程序,IE: 所有邮箱 > 特定邮箱 > 消息 其中“所有邮箱”和“特定邮箱”占据 Controller
我一直在使用 master 分支进行开发,并希望将其清除为只有发布提交,以及它的用途。如何将所有内容从 master 复制到开发分支,然后重新启动 master? 最佳答案 Create develo
两周前,我创建了一个新分支,我们称它为exp。在此期间,exp 和 master 中都有几次提交。在此期间,exp 尚未更新 master 的更改 现在我想把所有从 exp 到 master 的更改都
我克隆:https://github.com/vy2014/git_lesson.git 然后我做了一些改动,尝试通过命令git push推送到远程服务器,但是错误: Counting objects
有没有好的方法来解释如何在 Git 中解决“![rejected] master -> master (fetch first)'”? 当我使用此命令时 $ git push origin maste
我该怎么办: 1)恢复推送到主(远程)的更改 2)将这些更改移动到单独的分支 3) 稍后将这些更改移回 master 最佳答案 首先做 2),但前提是你真的需要分支。 git branch chang
符号上有什么区别? 在我的一个工作站上,我克隆的 git 存储库显示(master),而另一个工作站则显示(master -> origin) 我还创建了一个新的本地存储库,提交了一个文本文件,提示仍
我是一名优秀的程序员,十分优秀!