private ReplicatedEnvironment recover() { ReplicationConfig repConfig = new ReplicationConfig(); repConfig.setNodeName(nodeName); repConfig.setGroupName(groupName); repConfig.setNodeHostPort(nodeHost); EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setTransactional(true); return RepInternal.createDetachedEnv(envHome, repConfig, envConfig); }
private long extractEnvSetupTimeoutMillis(ReplicationConfig replicationConfig) { return (long) PropUtil.parseDuration(replicationConfig.getConfigParam(ReplicationConfig.ENV_SETUP_TIMEOUT)); }
/** * @hidden * Convenience constructor for transient nodes during unit tests. */ public RepNodeImpl(final ReplicationConfig repConfig) { this(new NameIdPair(repConfig.getNodeName(), NameIdPair.NULL_NODE_ID), repConfig.getNodeType(), repConfig.getNodeHostname(), repConfig.getNodePort(), JEVersion.CURRENT_VERSION); }
/** * @hidden * Internal convenience methods for returning replication sockets. * * This method should only be used when the configuration object is known * to have an authoritative value for its socket value. In a replication * node, the je.properties file may override the values in this * configuration object. */ public InetSocketAddress getNodeSocketAddress() { return new InetSocketAddress(getNodeHostname(), getNodePort()); }
/** * Creates a ReplicationConfig initialized with the system default * settings and the specified group name, node name, and hostname/port * values. * * <p>Note that the node name is immutable. Normally the host name should * not be used as the node name, unless you intend to reuse the host * name when a machine fails and is replaced, or the node is upgraded to * new hardware.</p> * * @param groupName the name for the replication group * @param nodeName the name for this node * @param hostPort the hostname and port for this node * * @see #setGroupName * @see #setNodeName */ public ReplicationConfig(String groupName, String nodeName, String hostPort) { super(); setGroupName(groupName); setNodeName(nodeName); setNodeHostPort(hostPort); }
throws InsufficientLogException { ReplicationConfig repConfig = new ReplicationConfig(); repConfig.setNodeName(nodeName); repConfig.setGroupName(groupName); repConfig.setNodeHostPort(hostPort); repConfig.setDesignatedPrimary(designatedPrimary); repConfig.setElectableGroupSizeOverride(electableGroupSize); repConfig.setNodeType(nodeType); repConfig.setHelperHosts(helpers);
envConfig.setDurability(durability); ReplicationConfig repConfig = new ReplicationConfig(); repConfig.setConfigParam (ReplicationConfig.ENV_CONSISTENCY_TIMEOUT, "1 min"); repConfig.setGroupName(groupName); repConfig.setNodeName(nodeName); int port = Integer.parseInt(RepParams.DEFAULT_PORT.getDefault()); String hostName = host + ":" + port; repConfig.setNodeHostPort(hostName); repConfig.setHelperHosts(hostName); final ReplicatedEnvironment rep = RepInternal.createDetachedEnv(envHome, repConfig, envConfig);
replicationEnvironmentParameters.putAll(_configuration.getReplicationParameters()); ReplicationConfig replicationConfig = new ReplicationConfig(groupName, nodeName, hostPort); replicationConfig.setHelperHosts(helperHostPort); replicationConfig.setDesignatedPrimary(designatedPrimary); replicationConfig.setNodePriority(priority); replicationConfig.setElectableGroupSizeOverride(quorumOverride); replicationConfig.setConfigParam(configItem.getKey(), configItem.getValue());
envConfig.setTransactional(true); repConfig = new ReplicationConfig(); repConfig.setNodeName(nodeName); repConfig.setGroupName(groupName); repConfig.setNodeHostPort(nodeHost); repConfig.setHelperHosts(helperHost); repConfig.setRepNetConfig(repNetConfig);
private Environment createEnvironment(final EnvironmentConfig config) throws Exception { final Environment env; if (_ha) { final ReplicationConfig repConfig = (ReplicationConfig) ReplicationConfig.DEFAULT .setNodeHostPort(_nodeHost) .setGroupName(_groupName) .setNodeName(_nodeName) .setDesignatedPrimary(true) .setElectableGroupSizeOverride(1); env = new ReplicatedEnvironment(new File(_storePath), repConfig, config); } else { env = new Environment(new File(_storePath), config); } return env; }
new ReplicationConfig(groupName, nodeName, nodeHostPort); repConfig.setHelperHosts(repConfig.getNodeHostPort()); repConfig.setConfigParam(RepParams.RESET_REP_GROUP.getName(), "true");
@Override public Environment open(File envHome, EnvironmentConfig envConfig, Map<String, String> repParams) { final String host = "localhost"; final FreePortLocator locator = new FreePortLocator (host, START_PORT, START_PORT + PORT_RANGE); final int port = locator.next(); final String hostPort = host + ':' + port; final ReplicationConfig repConfig = new ReplicationConfig ("DbCacheSizeGroup", "DbCacheSizeNode", hostPort); repConfig.setHelperHosts(hostPort); for (Map.Entry<String, String> entry : repParams.entrySet()) { repConfig.setConfigParam(entry.getKey(), entry.getValue()); } return new ReplicatedEnvironment(envHome, repConfig, envConfig); } }
int portVal = Integer.parseInt(props.getProperty(PORT)); ReplicationConfig repConfig = new ReplicationConfig(props.getProperty(GROUP_NAME), props.getProperty(NODE_NAME), HostPortPair.getString(hostname, portVal)); repConfig.setConfigParam(RepParams.NETWORKBACKUP_USE.getName(), "true"); repConfig.setRepNetConfig(repNetConfig);
new ReplicationConfig(getGroupName(), getSubNodeName(), getSubNodeHostPort()); repConfig.setConfigParam(RepParams.SUBSCRIBER_USE.getName(), "true"); repConfig.setRepNetConfig(rwc); repConfig.setConfigParam(RepParams.REPLICA_MESSAGE_QUEUE_SIZE.getName(), Integer.toString(getDefaultMsgQueueSize())); repConfig.setConfigParam( RepParams.REPLICA_TIMEOUT.getName(), String.valueOf(getChannelTimeout(TimeUnit.MILLISECONDS)) + " ms"); repConfig.setConfigParam( RepParams.PRE_HEARTBEAT_TIMEOUT.getName(), String.valueOf(getPreHeartbeatTimeout(TimeUnit.MILLISECONDS)) + " ms"); repConfig.setConfigParam( RepParams.REPSTREAM_OPEN_TIMEOUT.getName(), String.valueOf(getStreamOpenTimeout(TimeUnit.MILLISECONDS)) + " ms"); repConfig.setConfigParam(RepParams.HEARTBEAT_INTERVAL.getName(), Integer.toString(getHeartbeatIntervalMs()));
private ReplicationGroupAdmin createReplicationGroupAdmin() { final Set<InetSocketAddress> helpers = new HashSet<InetSocketAddress>(); final ReplicationConfig repConfig = getEnvironment().getRepConfig(); helpers.addAll(repConfig.getHelperSockets()); helpers.add(HostPortPair.getSocket(HostPortPair.getString(repConfig.getNodeHostname(), repConfig.getNodePort()))); return new ReplicationGroupAdmin(_configuration.getGroupName(), helpers); }
ReplicationConfig baseConfig = (repConfig == null) ? ReplicationConfig.DEFAULT : repConfig; ReplicationConfig useConfig = baseConfig.clone(); boolean arbUse = useConfig.getConfigParam( RepParams.ARBITER_USE.getName()).equals("true"); boolean subUse = useConfig.getConfigParam( RepParams.SUBSCRIBER_USE.getName()).equals("true"); boolean networkBackupUse = useConfig.getConfigParam( RepParams.NETWORKBACKUP_USE.getName()).equals("true"); useConfig.getProps(), true); /* forReplication */ useConfig.propagateRepNetProps(); this.handleRepConfig = useConfig; return handleRepConfig;
/** * Modify the log files in the environment directory to add a modicum of * replication required metadata. */ public void convert() { Durability durability = new Durability(Durability.SyncPolicy.WRITE_NO_SYNC, Durability.SyncPolicy.WRITE_NO_SYNC, Durability.ReplicaAckPolicy.SIMPLE_MAJORITY); EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); envConfig.setTransactional(true); envConfig.setDurability(durability); ReplicationConfig repConfig = new ReplicationConfig(groupName, nodeName, nodeHostPort); repConfig.setHelperHosts(repConfig.getNodeHostPort()); RepInternal.setAllowConvert(repConfig, true); ReplicatedEnvironment repEnv = new ReplicatedEnvironment(envHome, repConfig, envConfig); repEnv.close(); } }
repConfig.setHelperHosts(helperHost); } catch (Exception e) { System.err.println("Can't successfully initialize " + repConfig.getNodeName() + " because of " + e); System.exit(-1);
public static ReplicationConfig makeReplicationConfig(Properties props, boolean validateParams) throws IllegalArgumentException { return new ReplicationConfig(props, validateParams); }
new ReplicationConfig(getRepEnvProps(allProps)); repConfig.setConfigParam(RepParams.ARBITER_USE.getName(), "true"); repConfig.setRepNetConfig(ac.getRepNetConfig());