Metadata Repository
Background
Apache ShardingSphere provides different metadata persistence methods for different running modes. Users can freely choose the most appropriate way to store metadata while configuring the running mode.
Parameters
Database Repository
Type: JDBC
Mode: Standalone
Attributes:
Name | Type | Description | Default Value |
---|---|---|---|
provider | String | Type for metadata persist, the optional value is H2, MySQL | H2 |
jdbc_url | String | JDBC URL | jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL |
username | String | username | sa |
password | String | password |
ZooKeeper Repository
Type: ZooKeeper
Mode: Cluster
Attributes:
Name | Type | Description | Default Value |
---|---|---|---|
retryIntervalMilliseconds | int | Milliseconds of retry interval | 500 |
maxRetries | int | Max retries of client connection | 3 |
timeToLiveSeconds | int | Seconds of ephemeral data live | 60 |
operationTimeoutMilliseconds | int | Milliseconds of operation timeout | 500 |
digest | String | Password of login |
Etcd Repository
Type: Etcd
Mode: Cluster
Attributes:
Name | Type | Description | Default Value |
---|---|---|---|
timeToLiveSeconds | long | Seconds of ephemeral data live | 30 |
connectionTimeout | long | Seconds of connection timeout | 30 |
Consul Repository
Due to the limitation of the Maven module of com.ecwid.consul:consul-api:1.4.5
, users cannot connect to the Consul Agent through the gRPC port.
The serverLists
property of the Consul
implementation is by design and can only be connected to a single Consul Agent via an HTTP endpoint. serverLists
uses relaxed URL matching principles.
- When
serverLists
is empty, it will be resolved to the Consul Agent instance ofhttp://127.0.0.1:8500
. - When
serverLists
ishostName
, it will be resolved to the Consul Agent instance ofhttp://hostName:8500
. - When
serverLists
ishostName:port
, it will be resolved to the Consul Agent instance ofhttp://hostName:port
. - When
serverLists
ishttp://hostName:port
, it will be resolved to the Consul Agent instance ofhttp://hostName:port
. - When
serverLists
ishttps://hostName:port
, it will be resolved to the Consul Agent instance ofhttps://hostName:port
.
Type: Consul
Mode: Cluster
Attributes:
Name | Type | Description | Default Value |
---|---|---|---|
timeToLiveSeconds | String | Seconds of ephemeral instance live | 30s |
blockQueryTimeToSeconds | long | Seconds of query timeout | 60 |
Procedure
- Configure running mode in server.yaml.
- Configure metadata persistence warehouse type.
Sample
- Standalone mode configuration method.
mode:
type: Standalone
repository:
type: JDBC
props:
provider: H2
jdbc_url: jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
username: test
password: Test@123
- Cluster mode.
mode:
type: Cluster
repository:
type: zookeeper
props:
namespace: governance_ds
server-lists: localhost:2181
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .