1
0
Fork 0
arangodb/Documentation/Books/Users/ConfigureArango/Endpoint.mdpp

69 lines
3.3 KiB
Plaintext

!CHAPTER JavaScript Interface for managing Endpoints
The ArangoDB server can listen for incoming requests on multiple *endpoints*.
The endpoints are normally specified either in ArangoDB's configuration file or on
the command-line, using the ["--server.endpoint"](../CommandLineOptions/Arangod.md) option.
The default endpoint for ArangoDB is *tcp://127.0.0.1:8529* or *tcp://localhost:8529*.
The number of endpoints can also be changed at runtime using the API described
below. Each endpoint can optionally be restricted to a specific list of databases
only, thus allowing the usage of different port numbers for different databases.
This may be useful in multi-tenant setups.
A multi-endpoint setup may also be useful to turn on encrypted communication for
just specific databases.
The JavaScript interface for endpoints provides operations to add new endpoints at
runtime, and optionally restrict them for use with specific databases. The interface
also can be used to update existing endpoints or remove them at runtime.
Please note that all endpoint management operations can only be accessed via
the default database (*_system*) and none of the other databases.
When not in the default database, you must first switch to it using the
*db._useDatabase* method.
!SECTION Configuring and Removing Endpoints
`db._listEndpoints()`
Returns a list of all endpoints and their mapped databases.
Please note that managing endpoints can only be performed from out of the *_system* database. When not in the default database, you must first switch to it using the *db._useDatabase* method.
`db._configureEndpoint(endpoint, databases)`
Adds and connects or updates the endpoint.
The optional databases argument allows restricting the endpoint for use with specific databases only. The first database in the list will automatically become the default database for the endpoint. The default database will be used for incoming requests that do not specify the database name explicitly.
If databases is an empty list, the endpoint will allow access to all existing databases.
The adjusted list of endpoints is saved in a file *ENDPOINTS* in the database directory. The endpoints are restored from the file at server start.
Please note that managing endpoints can only be performed from out of the *_system* database. When not in the default database, you must first switch to it using the *db._useDatabase* method.
`db._removeEndpoint(endpoint)`
Disconnects and removes the endpoint. If the endpoint was not configured before, the operation will fail. If the endpoint happens to be the last bound endpoint, the operation will also fail as disconnecting would make the server unable to communicate with any clients.
The adjusted list of endpoints is saved in a file *ENDPOINTS* in the database directory. The endpoints are restored from the file at server start.
Please note that managing endpoints can only be performed from out of the *_system* database. When not in the default database, you must first switch to it using the *db._useDatabase* method.
<!--
@anchor HandlingEndpointsList
@copydetails JSF_ArangoDatabase_prototype__listEndpoints
@CLEARPAGE
@anchor HandlingEndpointsConfigure
@copydetails JSF_ArangoDatabase_prototype__configureEndpoint
@CLEARPAGE
@anchor HandlingEndpointsRemove
@copydetails JSF_ArangoDatabase_prototype__removeEndpoint
-->