Search in sources :

Example 1 with SharedDiscoveryService

use of org.neo4j.causalclustering.discovery.SharedDiscoveryService in project neo4j by neo4j.

the class ClusterSeedingIT method shouldSeedNewMemberFromEmptyIdleCluster.

@Test
public void shouldSeedNewMemberFromEmptyIdleCluster() throws Throwable {
    // given
    cluster = new Cluster(testDir.directory("cluster-b"), 3, 0, new SharedDiscoveryService(), emptyMap(), backupParams(), emptyMap(), emptyMap(), Standard.LATEST_NAME);
    cluster.start();
    // when: creating a backup
    File backupDir = createBackup(cluster.getCoreMemberById(0).database(), "the-backup");
    // and: seeding new member with said backup
    CoreClusterMember newMember = cluster.addCoreMemberWithId(3);
    fsa.copyRecursively(backupDir, newMember.storeDir());
    newMember.start();
    // then
    dataMatchesEventually(DbRepresentation.of(newMember.database()), cluster.coreMembers());
}
Also used : CoreClusterMember(org.neo4j.causalclustering.discovery.CoreClusterMember) Cluster(org.neo4j.causalclustering.discovery.Cluster) SharedDiscoveryService(org.neo4j.causalclustering.discovery.SharedDiscoveryService) File(java.io.File) Test(org.junit.Test)

Example 2 with SharedDiscoveryService

use of org.neo4j.causalclustering.discovery.SharedDiscoveryService in project neo4j by neo4j.

the class ClusterSeedingIT method setup.

@Before
public void setup() throws Exception {
    fsa = fileSystemRule.get();
    backupCluster = new Cluster(testDir.directory("cluster-for-backup"), 3, 0, new SharedDiscoveryService(), emptyMap(), backupParams(), emptyMap(), emptyMap(), Standard.LATEST_NAME);
    cluster = new Cluster(testDir.directory("cluster-b"), 3, 0, new SharedDiscoveryService(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), Standard.LATEST_NAME);
    baseBackupDir = testDir.directory("backups");
}
Also used : Cluster(org.neo4j.causalclustering.discovery.Cluster) SharedDiscoveryService(org.neo4j.causalclustering.discovery.SharedDiscoveryService) Before(org.junit.Before)

Example 3 with SharedDiscoveryService

use of org.neo4j.causalclustering.discovery.SharedDiscoveryService in project neo4j by neo4j.

the class ClusterSeedingIT method shouldSeedNewMemberFromNonEmptyIdleCluster.

@Test
public void shouldSeedNewMemberFromNonEmptyIdleCluster() throws Throwable {
    // given
    cluster = new Cluster(testDir.directory("cluster-b"), 3, 0, new SharedDiscoveryService(), emptyMap(), backupParams(), emptyMap(), emptyMap(), Standard.LATEST_NAME);
    cluster.start();
    createEmptyNodes(cluster, 100);
    // when: creating a backup
    File backupDir = createBackup(cluster.getCoreMemberById(0).database(), "the-backup");
    // and: seeding new member with said backup
    CoreClusterMember newMember = cluster.addCoreMemberWithId(3);
    fsa.copyRecursively(backupDir, newMember.storeDir());
    newMember.start();
    // then
    dataMatchesEventually(DbRepresentation.of(newMember.database()), cluster.coreMembers());
}
Also used : CoreClusterMember(org.neo4j.causalclustering.discovery.CoreClusterMember) Cluster(org.neo4j.causalclustering.discovery.Cluster) SharedDiscoveryService(org.neo4j.causalclustering.discovery.SharedDiscoveryService) File(java.io.File) Test(org.junit.Test)

Aggregations

Cluster (org.neo4j.causalclustering.discovery.Cluster)3 SharedDiscoveryService (org.neo4j.causalclustering.discovery.SharedDiscoveryService)3 File (java.io.File)2 Test (org.junit.Test)2 CoreClusterMember (org.neo4j.causalclustering.discovery.CoreClusterMember)2 Before (org.junit.Before)1