blob: 4772df7e9428890c03ea7f170fd5999595a2b735 [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>YAML 配置 on ShardingSphere</title>
<link>https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/</link>
<description>Recent content in YAML 配置 on ShardingSphere</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>模式配置</title>
<link>https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/mode/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/mode/</guid>
<description>参数解释 mode (?): # 不配置则默认单机模式 type: # 运行模式类型。可选配置:Standalone、Cluster repository (?): # 久化仓库配置 overwrite: # 是否使用本地配置覆盖持久化配置 单机模式 mode: type: Standalone repository: type: # 持久化仓库类型 props: # 持久化仓库所需属性 foo_key: foo_value bar_key: bar_value overwrite: # 是否使用本地配置覆盖持久化配置 集群模式 (推荐) mode: type: Cluster repository: type: # 持久化仓库类型 props: # 持久化仓库所需属性 namespace: # 注册中心命名空间 server-lists: # 注册中心连接地址 foo_key: foo_value bar_key: bar_value overwrite: # 是否使用本地配置覆盖持久化配置 注意事项 生产环境建议使用集群模式部署。 集群模式部署推荐使用 ZooKeeper 注册中心。 配置示例 单机模式 mode: type: Standalone repository: type: File overwrite: false 集群模式 (推荐) mode: type: Cluster repository: type: ZooKeeper props: namespace: governance server-lists: localhost:2181 retryIntervalMilliseconds: 500 timeToLiveSeconds: 60 overwrite: false 相关参考 ZooKeeper 注册中心安装与使用 持久化仓库类型的详情,请参见内置持久化仓库类型列表。 </description>
</item>
<item>
<title>数据源配置</title>
<link>https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/data-source/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/data-source/</guid>
<description>背景信息 ShardingSphere-JDBC 支持所有的数据库 JDBC 驱动和连接池。
示例的数据库驱动为 MySQL,连接池为 HikariCP,可以更换为其他数据库驱动和连接池。当使用 ShardingSphere-JDBC 时,JDBC 池的属性名取决于各自 JDBC 池自己的定义,并不由 ShardingSphere 硬定义,相关的处理可以参考类org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator。例如对于 Alibaba Druid 1.2.9 而言,使用 url 代替如下示例中的 jdbcUrl 是预期行为。
参数解释 dataSources: # 数据源配置,可配置多个 &amp;lt;data-source-name&amp;gt; &amp;lt;data-source-name&amp;gt;: # 数据源名称 dataSourceClassName: # 数据源完整类名 driverClassName: # 数据库驱动类名,以数据库连接池自身配置为准 jdbcUrl: # 数据库 URL 连接,以数据库连接池自身配置为准 username: # 数据库用户名,以数据库连接池自身配置为准 password: # 数据库密码,以数据库连接池自身配置为准 # ... 数据库连接池的其它属性 配置示例 dataSources: ds_1: dataSourceClassName: com.zaxxer.hikari.HikariDataSource driverClassName: com.mysql.jdbc.Driver jdbcUrl: jdbc:mysql://localhost:3306/ds_1 username: root password: ds_2: dataSourceClassName: com.zaxxer.hikari.HikariDataSource driverClassName: com.mysql.jdbc.Driver jdbcUrl: jdbc:mysql://localhost:3306/ds_2 username: root password: # 配置其他数据源 </description>
</item>
</channel>
</rss>