Search in sources :

Example 1 with ClusterDatabaseManagementServiceBuilder

use of com.neo4j.dbms.api.ClusterDatabaseManagementServiceBuilder in project neo4j-documentation by neo4j.

the class EmbeddedNeo4jClusterUsingBuilder method main.

public static void main(final String[] args) throws IOException {
    System.out.println("Starting database ...");
    FileUtils.deleteDirectory(homeDirectory);
    // tag::startCore[]
    var defaultAdvertised = new SocketAddress("core01.example.com");
    var defaultListen = new SocketAddress("0.0.0.0");
    var initialMembers = List.of(new SocketAddress("core01.example.com"), new SocketAddress("core02.example.com"), new SocketAddress("core03.example.com"));
    var managementService = new ClusterDatabaseManagementServiceBuilder(homeDirectory).setConfig(GraphDatabaseSettings.mode, CORE).setConfig(GraphDatabaseSettings.default_advertised_address, defaultAdvertised).setConfig(GraphDatabaseSettings.default_listen_address, defaultListen).setConfig(CausalClusteringSettings.discovery_type, DiscoveryType.LIST).setConfig(CausalClusteringSettings.initial_discovery_members, initialMembers).setConfig(BoltConnector.enabled, true).setConfig(HttpConnector.enabled, true).build();
    // end::startCore[]
    // This is the neo4j.conf that should go together with the loading of the property file in EmbeddedNeo4jClusterUsingNeo4jConf
    // but kept in this example file because it should be equivalent to the above configuration.
    /* tag::neo4jConf[]

        dbms.mode=CORE
        dbms.default_advertised_address=core01.example.com
        dbms.default_listen_address=0.0.0.0
        causal_clustering.discovery_type=LIST
        causal_clustering.initial_discovery_members=core01.example.com,core02.example.com,core03.example.com
        dbms.connector.bolt.enabled=true
        dbms.connector.http.enabled=true

        end::neo4jConf[] */
    managementService.shutdown();
}
Also used : SocketAddress(org.neo4j.configuration.helpers.SocketAddress) ClusterDatabaseManagementServiceBuilder(com.neo4j.dbms.api.ClusterDatabaseManagementServiceBuilder)

Aggregations

ClusterDatabaseManagementServiceBuilder (com.neo4j.dbms.api.ClusterDatabaseManagementServiceBuilder)1 SocketAddress (org.neo4j.configuration.helpers.SocketAddress)1