private Map<String, Object> nodeToAttributes(ReplicationNode replicationNode) { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put(ConfiguredObject.NAME, replicationNode.getName()); attributes.put(ConfiguredObject.DURABLE, false); attributes.put(BDBHARemoteReplicationNode.ADDRESS, replicationNode.getHostName() + ":" + replicationNode.getPort()); attributes.put(BDBHARemoteReplicationNode.MONITOR, replicationNode.getType() == NodeType.MONITOR); return attributes; } }
/** * @hidden SSL deferred * Create a DbPing instance for programmatic use. * * @param repNode a class that implements * {@link com.sleepycat.je.rep.ReplicationNode} * @param groupName name of the group which the node joins * @param socketTimeout timeout value for creating a socket connection * with the node * @param channelFactory the factory for channel creation * @throws IllegalArgumentException if the netProps contains invalid * settings. */ public DbPing(ReplicationNode repNode, String groupName, int socketTimeout, DataChannelFactory channelFactory) { this.nodeName = repNode.getName(); this.groupName = groupName; this.socketAddress = repNode.getSocketAddress(); this.socketTimeout = socketTimeout; this.channelFactory = channelFactory; }
@Override public String getArguments() { return "ReplicationNode[" + _replicationNode.getName() + " from " + _replicationNode.getHostName() + ":" + _replicationNode.getPort() + "]"; }
private String getHostPort(ReplicationNode replicationNode) { return replicationNode.getHostName() + ":" + replicationNode.getPort(); }
@Override public String toString() { return node.getName(); } }
if (!repNode.getType().hasTransientId()) { groupMembers.add(repNode.getName()); if (repNode.getType().isMonitor()) { continue; (repNode.getSocketAddress(), NodeStateService.SERVICE_NAME, stateProtocol.new NodeStateRequest(repNode.getName())); me.run(); ResponseMessage resp = me.getResponseMessage();
server.node.getSocketAddress(); if (serverSocket.equals(repImpl.getSocket())) {
private boolean processIntruderNode(final ReplicationNode node) final String hostAndPort = node.getHostName() + ":" + node.getPort(); getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.INTRUDER_DETECTED(node.getName(), hostAndPort)); BDBHARemoteReplicationNodeImpl remoteNode = getChildByName(BDBHARemoteReplicationNodeImpl.class, node.getName()); if (remoteNode == null) node.getName(), hostAndPort, BDBHAVirtualHostNodeImpl.this.getName(),
@Override public String getArguments() { return "ReplicationNode[" + node.getName() + " from " + hostAndPort + "]"; } });
private Properties initProperties(String groupName) { Properties p = new Properties(); /* * These apply to the destination node which is experiencing the * insufficient logs. */ p.setProperty(GROUP_NAME, groupName); p.setProperty(NODE_NAME, repImpl.getNameIdPair().getName()); p.setProperty(HOSTNAME, repImpl.getHostName()); p.setProperty(PORT, Integer.toString(repImpl.getPort())); p.setProperty(ENV_DIR, repImpl.getEnvironmentHome().getPath()); p.setProperty(REFRESH_VLSN, Long.toString(refreshVLSN.getSequence())); /* * There is a set of nodes which might act as the source for the * network restore. Since we can't store arrays, append an index * to the property name for each log provider. */ p.setProperty(P_NUMPROVIDERS, Integer.toString(logProviders.size())); int i = 0; for (ReplicationNode rn: logProviders) { p.setProperty(P_NODENAME + i, rn.getName()); p.setProperty(P_HOSTNAME + i, rn.getHostName()); p.setProperty(P_PORT + i, Integer.toString(rn.getPort())); p.setProperty(P_NODETYPE + i, rn.getType().name()); i++; } return p; }
for (ReplicationNode node : remoteNodes) String nodeAddress = node.getHostName() + ":" + node.getPort(); if (!_permittedNodes.contains(nodeAddress)) getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.INTRUDER_DETECTED(node.getName(), nodeAddress)); shutdownOnIntruder(nodeAddress);
/** * @hidden SSL deferred * Create a DbPing instance for programmatic use. * * @param repNode a class that implements * {@link com.sleepycat.je.rep.ReplicationNode} * @param groupName name of the group which the node joins * @param socketTimeout timeout value for creating a socket connection * with the node * @param netConfig a replication-net configuration object * property settings. Null is allowed. * @throws IllegalArgumentException if the netProps contains invalid * settings. */ public DbPing(ReplicationNode repNode, String groupName, int socketTimeout, ReplicationNetworkConfig netConfig) { this(repNode, groupName, socketTimeout, initializeFactory(netConfig, repNode.getName())); }
private boolean onIntruder(ReplicationGroupListener replicationGroupListener, ReplicationNode replicationNode) { if (replicationGroupListener != null) { return replicationGroupListener.onIntruderNode(replicationNode); } else { LOGGER.warn(String.format( "Found an intruder node '%s' from ''%s' . The node is not listed in permitted list: %s", replicationNode.getName(), getHostPort(replicationNode), String.valueOf(_permittedNodes))); return true; } }
private void populateExistingRemoteReplicationNodes() { try { ReplicationGroup group = getEnvironment().getGroup(); Set<ReplicationNode> nodes = new HashSet<>(group.getElectableNodes()); String localNodeName = getNodeName(); for (ReplicationNode replicationNode : nodes) { String discoveredNodeName = replicationNode.getName(); if (!discoveredNodeName.equals(localNodeName)) { _remoteReplicationNodes.put(replicationNode.getName(), replicationNode); } } } catch (RuntimeException e) { // should never happen handleDatabaseException("Exception on discovery of existing nodes", e); } }
String nodeName = node.getName(); Future<Void> future = entry.getValue(); try
for (ReplicationNode replicationNode : nodes) String discoveredNodeName = replicationNode.getName(); if (!discoveredNodeName.equals(localNodeName))
NodeState nodeState = entry.getValue(); ReplicatedEnvironment.State state = nodeState == null ? ReplicatedEnvironment.State.UNKNOWN : nodeState.getNodeState(); currentGroupState.put(node.getName(), state);
final Set<String> memberNames = new HashSet<>(); for (ReplicationNode node : logException.getLogProviders()) { memberNames.add(node.getName()); if (!memberNames.contains(node.getName())) { throw new IllegalArgumentException ("Node:" + node.getName() + " is not a suitable member for NetworkRestore." + " It's not a member of logException." +
private void removeRemoteReplicationNode(ReplicationNode node) { BDBHARemoteReplicationNodeImpl remoteNode = getChildByName(BDBHARemoteReplicationNodeImpl.class, node.getName()); if (remoteNode != null) { remoteNode.setNodeLeft(true); doAfter(remoteNode.deleteNoChecks(), () -> getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.REMOVED(remoteNode.getName(), remoteNode.getAddress()))); } }