@Override protected void startUp() throws Exception { logBanner(); if (!config.getNoZooKeeperMasterRegistration()) { zkRegistrar.startAsync().awaitRunning(); } expiredJobReaper.startAsync().awaitRunning(); rollingUpdateService.startAsync().awaitRunning(); agentReaper.ifPresent(reaper -> reaper.startAsync().awaitRunning()); oldJobReaper.ifPresent(reaper -> reaper.startAsync().awaitRunning()); jobHistoryReaper.ifPresent(reaper -> reaper.startAsync().awaitRunning()); try { server.start(); } catch (Exception e) { log.error("Unable to start server, shutting down", e); server.stop(); } final ServiceRegistration serviceRegistration = ServiceRegistration.newBuilder() .endpoint("helios", "http", config.getHttpEndpoint().getPort(), config.getDomain(), config.getName()) .build(); registrar.register(serviceRegistration); }
zkRegistrar = ZooKeeperRegistrarService.newBuilder() .setZooKeeperClient(client) .setZooKeeperRegistrar(new MasterZooKeeperRegistrar(config.getName())) .build();
new ZooKeeperMasterModel(zkClientProvider, config.getName(), eventSenders, DG_EVENT_TOPIC);
@Override protected void startUp() throws Exception { logBanner(); if (!config.getNoZooKeeperMasterRegistration()) { zkRegistrar.startAsync().awaitRunning(); } expiredJobReaper.startAsync().awaitRunning(); rollingUpdateService.startAsync().awaitRunning(); try { server.start(); } catch (Exception e) { log.error("Unable to start server, shutting down", e); server.stop(); } final ServiceRegistration serviceRegistration = ServiceRegistration.newBuilder() .endpoint("helios", "http", config.getHttpEndpoint().getPort(), config.getDomain(), config.getName()) .build(); registrar.register(serviceRegistration); }
/** * Create a Zookeeper client and create the control and state nodes if needed. * * @param config The service configuration. * @return A zookeeper client. */ private ZooKeeperClient setupZookeeperClient(final MasterConfig config) { final RetryPolicy zooKeeperRetryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework curator = curatorClientFactory.newClient( config.getZooKeeperConnectionString(), config.getZooKeeperSessionTimeoutMillis(), config.getZooKeeperConnectionTimeoutMillis(), zooKeeperRetryPolicy, config.getZooKeeperNamespace()); final ZooKeeperClient client = new DefaultZooKeeperClient(curator, config.getZooKeeperClusterId()); client.start(); zkRegistrar = new ZooKeeperRegistrar(client, new MasterZooKeeperRegistrar(config.getName())); return client; } }