This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Server Connection
Chiho Sin edited this page Aug 18, 2016
·
3 revisions
Use FileSource create connection for SeaweedFS server.
You can custom client connection by setting properties.
| Setting | Description |
|---|---|
setHost("127.0.0.1") |
Target master server host. |
setPort(9333) |
Target master server port. |
setConnectionTimeout(5) |
Http connection timeout (in second). |
setStatusExpiry(30) |
Server and topology status expiry (in second). |
setIdleConnectionExpiry(60) |
Http connection idle expiry (in second). |
setMaxConnection(1000) |
Max http connection. |
setMaxConnectionsPreRoute(100) |
Max connections pre route. |
setEnableLookupVolumeCache(true) |
Enable lookup volume cache. |
setLookupVolumeCacheExpiry(120) |
Lookup volume cache expiry (in second). |
setLookupVolumeCacheEntries(10000) |
Lookup volume cache entries. |
setEnableFileStreamCache(true) |
Enable file stream cache. |
setFileStreamCacheEntries(8192) |
File stream cache entries. |
setFileStreamCacheSize(1000) |
File stream cache size. |
setFileStreamCacheStorage(cacheStorage) |
File stream cache storage, implement interface HttpCacheStorage from Http client. |
Startup connection and monitoring server change, but you have to startup after setting properties, otherwise, it is of no efficiency.
dataSource.startup();dataSource.shutdown();If this library running with Spring Framework and managed by application context, you don't have to manual startup or shutdown the connection.
You can get server topology status by Connection.
// Get connection by file source.
Connection conn = dataSource.getConnection();
// Get topology status.
conn.getSystemTopologyStatus();
// Get master cluster status.
conn.getSystemClusterStatus();