use of org.neo4j.configuration.helpers.SocketAddress 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();
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j-documentation by neo4j.
the class EmbeddedNeo4jWithBolt method main.
public static void main(final String[] args) throws IOException {
System.out.println("Starting database ...");
FileUtils.deleteDirectory(DB_PATH);
// tag::startDb[]
DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(DB_PATH).setConfig(BoltConnector.enabled, true).setConfig(BoltConnector.listen_address, new SocketAddress("localhost", 7687)).build();
// end::startDb[]
managementService.shutdown();
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j-documentation by neo4j.
the class Neo4jInstance method newEnterpriseInstance.
public DatabaseManagementService newEnterpriseInstance() throws IOException {
Files.createDirectories(baseDatabaseDirectory);
DatabaseManagementService managementService = new EnterpriseDatabaseManagementServiceBuilder(databaseDirectory()).setConfig(Map.of(OnlineBackupSettings.online_backup_listen_address, new SocketAddress("127.0.0.1", 0), OnlineBackupSettings.online_backup_enabled, java.lang.Boolean.FALSE, GraphDatabaseSettings.auth_enabled, true)).build();
registerShutdownHook(managementService);
return managementService;
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class AbstractNeoWebServer method registerHttpAddressAfterStartup.
private void registerHttpAddressAfterStartup() {
if (httpEnabled) {
InetSocketAddress localHttpAddress = webServer.getLocalHttpAddress();
connectorPortRegister.register(HttpConnector.NAME, localHttpAddress);
if (httpAdvertisedAddress.getPort() == 0) {
httpAdvertisedAddress = new SocketAddress(localHttpAddress.getHostString(), localHttpAddress.getPort());
}
}
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class AbstractInProcessNeo4jBuilder method setWorkingDirectory.
private void setWorkingDirectory(Path workingDir) {
setDirectory(workingDir);
withConfig(auth_enabled, false);
withConfig(pagecache_memory, "8m");
withConfig(HttpConnector.enabled, true);
withConfig(HttpConnector.listen_address, new SocketAddress("localhost", 0));
withConfig(HttpsConnector.enabled, false);
withConfig(HttpsConnector.listen_address, new SocketAddress("localhost", 0));
withConfig(BoltConnector.enabled, true);
withConfig(BoltConnector.listen_address, new SocketAddress("localhost", 0));
}
Aggregations