blob: fa1540f656599d3460cfc5a25863df4312632235 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Governance on ShardingSphere</title>
<link>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/</link>
<description>Recent content in Governance on ShardingSphere</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Use Java API</title>
<link>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/java-api/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/java-api/</guid>
<description>Import Maven Dependency &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-jdbc-governance&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using ZooKeeper --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-zookeeper-curator&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using Etcd --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-etcd&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; Configure Rule Using ZooKeeper as config center and registry center for example.
// Omit configure data sources and rule configurations // ... // Configure registry center GovernanceCenterConfiguration configuration = new GovernanceCenterConfiguration(&amp;#34;Zookeeper&amp;#34;, &amp;#34;localhost:2181&amp;#34;, new Properties()); // Configure governance Map&amp;lt;String, CenterConfiguration&amp;gt; configurationMap = new HashMap&amp;lt;String, CenterConfiguration&amp;gt;(); configurationMap.</description>
</item>
<item>
<title>Use YAML</title>
<link>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/yaml/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/yaml/</guid>
<description>Import Maven Dependency &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-jdbc-governance&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using ZooKeeper --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-zookeeper-curator&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using Etcd --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-etcd&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; Configure Rule Using ZooKeeper as config center and registry center for example.
governance: name: governance_ds registryCenter: type: Zookeeper serverLists: localhost:2181 overwrite: true // Create GovernanceShardingSphereDataSource DataSource dataSource = YamlGovernanceShardingSphereDataSourceFactory.createDataSource(yamlFile); Use GovernanceShardingSphereDataSource The GovernanceShardingSphereDataSource created by YamlGovernanceShardingSphereDataSourceFactory implements the standard JDBC DataSource interface.</description>
</item>
<item>
<title>Use Spring Boot Starter</title>
<link>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/spring-boot-starter/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/spring-boot-starter/</guid>
<description>Import Maven Dependency &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-jdbc-governance-spring-boot-starter&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using ZooKeeper --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-zookeeper-curator&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using Etcd --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-etcd&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; Configure Rule spring.shardingsphere.governance.name=governance-spring-boot-shardingsphere-test spring.shardingsphere.governance.registry-center.type=Zookeeper spring.shardingsphere.governance.registry-center.server-lists=localhost:2181 spring.shardingsphere.governance.overwrite=true Use GovernanceShardingSphereDataSource in Spring GovernanceShardingSphereDataSource can be used directly by injection; or configure GovernanceShardingSphereDataSource in ORM frameworks such as JPA or MyBatis.
@Resource private DataSource dataSource; </description>
</item>
<item>
<title>Use Spring Namespace</title>
<link>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/spring-namespace/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/usage/governance/spring-namespace/</guid>
<description>Import Maven Dependency &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-jdbc-governance-spring-namespace&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using ZooKeeper --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-zookeeper-curator&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; &amp;lt;!-- import if using Etcd --&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.shardingsphere&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;shardingsphere-governance-repository-etcd&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;${shardingsphere.version}&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt; Configure Rule &amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt; &amp;lt;beans xmlns:xsi=&amp;#34;http://www.w3.org/2001/XMLSchema-instance&amp;#34; xmlns:governance=&amp;#34;http://shardingsphere.apache.org/schema/shardingsphere/governance&amp;#34; xmlns=&amp;#34;http://www.springframework.org/schema/beans&amp;#34; xsi:schemaLocation=&amp;#34;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://shardingsphere.apache.org/schema/shardingsphere/governance http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd&amp;#34;&amp;gt; &amp;lt;util:properties id=&amp;#34;instance-properties&amp;#34;&amp;gt; &amp;lt;prop key=&amp;#34;max-retries&amp;#34;&amp;gt;3&amp;lt;/prop&amp;gt; &amp;lt;prop key=&amp;#34;operation-timeout-milliseconds&amp;#34;&amp;gt;3000&amp;lt;/prop&amp;gt; &amp;lt;/util:properties&amp;gt; &amp;lt;governance:reg-center id=&amp;#34;regCenter&amp;#34; type=&amp;#34;Zookeeper&amp;#34; server-lists=&amp;#34;localhost:2181&amp;#34; /&amp;gt; &amp;lt;governance:data-source id=&amp;#34;shardingDatabasesTablesDataSource&amp;#34; data-source-names=&amp;#34;demo_ds_0, demo_ds_1&amp;#34; reg-center-ref=&amp;#34;regCenter&amp;#34; config-center-ref=&amp;#34;configCenter&amp;#34; rule-refs=&amp;#34;shardingRule&amp;#34; overwrite=&amp;#34;true&amp;#34; /&amp;gt; &amp;lt;governance:data-source id=&amp;#34;encryptDataSource&amp;#34; data-source-names=&amp;#34;demo_ds&amp;#34; reg-center-ref=&amp;#34;regCenter&amp;#34; config-center-ref=&amp;#34;configCenter&amp;#34; rule-refs=&amp;#34;encryptRule&amp;#34; overwrite=&amp;#34;true&amp;#34; &amp;gt; &amp;lt;props&amp;gt; &amp;lt;prop key=&amp;#34;query-with-cipher-column&amp;#34;&amp;gt;true&amp;lt;/prop&amp;gt; &amp;lt;/props&amp;gt; &amp;lt;/governance:data-source&amp;gt; &amp;lt;/beans&amp;gt; Use GovernanceShardingSphereDataSource in Spring GovernanceShardingSphereDataSource can be used directly by injection; or configure GovernanceShardingSphereDataSource in ORM frameworks such as JPA or MyBatis.</description>
</item>
</channel>
</rss>