use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.
the class StandbyStoreService method bootstrapMaster.
private void bootstrapMaster(ComponentContext context, FileStore fileStore) {
Dictionary<?, ?> props = context.getProperties();
int port = PropertiesUtil.toInteger(props.get(PORT), PORT_DEFAULT);
String[] ranges = PropertiesUtil.toStringArray(props.get(ALLOWED_CLIENT_IP_RANGES), ALLOWED_CLIENT_IP_RANGES_DEFAULT);
boolean secure = PropertiesUtil.toBoolean(props.get(SECURE), SECURE_DEFAULT);
StandbyServerSync standbyServerSync = new StandbyServerSync(port, fileStore, BLOB_CHUNK_SIZE, ranges, secure);
closer.register(standbyServerSync);
standbyServerSync.start();
log.info("Started primary on port {} with allowed IP ranges {}", port, ranges);
}
use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.
the class BrokenNetworkIT method useProxy.
private void useProxy(boolean ssl, int skipPosition, int skipBytes, int flipPosition, boolean intermediateChange) throws Exception {
FileStore serverStore = serverFileStore.fileStore();
FileStore clientStore = clientFileStore1.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(serverStore).build();
addTestContent(store, "server");
serverStore.flush();
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), serverStore, MB, ssl)) {
serverSync.start();
File spoolFolder = folder.newFolder();
try (NetworkErrorProxy ignored = new NetworkErrorProxy(proxyPort.getPort(), getServerHost(), serverPort.getPort(), flipPosition, skipPosition, skipBytes);
StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), proxyPort.getPort(), clientStore, ssl, getClientTimeout(), false, spoolFolder)) {
clientSync.run();
}
assertFalse("stores are equal", serverStore.getHead().equals(clientStore.getHead()));
if (intermediateChange) {
addTestContent(store, "server2");
serverStore.flush();
}
try (StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), clientStore, ssl, getClientTimeout(), false, spoolFolder)) {
clientSync.run();
}
}
assertEquals("stores are not equal", serverStore.getHead(), clientStore.getHead());
}
use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.
the class BrokenNetworkIT method testProxy.
@Test
public void testProxy() throws Exception {
FileStore serverStore = serverFileStore.fileStore();
FileStore clientStore = clientFileStore1.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(serverStore).build();
addTestContent(store, "server");
serverStore.flush();
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), serverStore, MB, false);
StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), clientStore, false, getClientTimeout(), false, folder.newFolder())) {
serverSync.start();
clientSync.run();
}
assertEquals(serverStore.getHead(), clientStore.getHead());
}
use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.
the class BrokenNetworkIT method testProxySSL.
@Test
public void testProxySSL() throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore1.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
addTestContent(store, "server");
storeS.flush();
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS, MB, true);
StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), storeC, true, getClientTimeout(), false, folder.newFolder())) {
serverSync.start();
clientSync.run();
}
assertEquals(storeS.getHead(), storeC.getHead());
}
use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.
the class FailoverIPRangeIT method createTestWithConfig.
private void createTestWithConfig(String host, String[] ipRanges, boolean expectedToWork) throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS, MB, ipRanges);
StandbyClientSync clientSync = new StandbyClientSync(host, serverPort.getPort(), storeC, false, getClientTimeout(), false, folder.newFolder())) {
serverSync.start();
addTestContent(store, "server");
// this speeds up the test a little bit...
storeS.flush();
clientSync.run();
if (expectedToWork) {
assertEquals(storeS.getHead(), storeC.getHead());
} else {
assertFalse("stores are equal but shouldn't!", storeS.getHead().equals(storeC.getHead()));
}
}
}
Aggregations