In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what is the method of sharding-proxy docker packaging, deployment and testing". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Prepare the mysql master/slave environment.
2. Package and deploy by yourself:
Pack it yourself, download apache-shardingsphere-4.1.1-sharding-proxy-bin.tar.gzcurl-O https://archive.apache.org/dist/shardingsphere/4.1.1/apache-shardingsphere-4.1.1-sharding-proxy-bin.tar.gz first, decompress it, and if you connect mysq8.0 Copy the mysql-connector-java-8.0.15.jar driver package to [Dockfile] FROM openjdk:8-jre-slimMAINTAINER summerRUN ln-sf / usr/share/zoneinfo/$TZ / etc/localtime & & echo $TZ > / etc/timezoneADD apache-shardingsphere-4.1.1-sharding-proxy-bin / opt/sharding-proxyENTRYPOINT ["/ bin/sh", "- c" under lib "/ opt/sharding-proxy/bin/start.sh ${PORT} & & tail-f / opt/sharding-proxy/logs/stdout.log"] [Build] docker build-t summer/sharding-proxy:v1.0.0. Docker run\-v / root/dev/sharding-proxy/conf:/opt/sharding-proxy/conf\-v / root/dev/sharding-proxy/logs:/opt/sharding-proxy/logs\-- link mysql-master:mysql-master-host\-- link mysql-slave0:mysql-slave0-host\-e PORT=3306-p3307 root/dev/sharding-proxy/logs:/opt/sharding-proxy/logs 3306-- name sharding-proxy-d summer/sharding-proxy:v1.0.0
2. Package and deploy with an official image
Docker pull apache/sharding-proxy:4.1.1 build / root/dev/sharding-proxy/conf / root/dev/sharding-proxy/logs / root/dev/sharding-proxy/ext-lib copy mysql-connector-java-8.0.15.jar to ext-libdocker run\-v / root/dev/sharding-proxy/conf:/opt/sharding-proxy/conf\-v / root/dev/sharding-proxy/logs:/opt/sharding-proxy/logs\ -v / root/dev/sharding-proxy/ext-lib:/opt/sharding-proxy/ext-lib\-- link mysql-master:mysql-master-host\-- link mysql-slave0:mysql-slave0-host\-e PORT=3306-p3307 PORT=3306 3306-- name apache-sharding-proxy-d apache/sharding-proxy:4.1.1 modify configuration file: [server.yaml] authentication: users: root: password: root sharding: Password: sharding authorizedSchemas: sharding_dbprops: max.connections.size.per.query: 1 acceptor.size: 16 # The default value is available processors count * 2. Executor.size: 16 # Infinite by default. [config-base.yaml] schemaName: sharding_dbdataSources: master_ds: url: jdbc:mysql://mysql-master-host:3306/shardingjdbc?serverTimezone=UTC&useSSL=false username: base_sa password: base_sa connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 slave_ds_0: url: jdbc:mysql://mysql-slave0-host:3306/shardingjdbc?serverTimezone=UTC&useSSL=false username: base_sa password: base_sa connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50masterSlaveRule: name: ms_ds masterDataSourceName: master_ds slaveDataSourceNames:-slave_ds_0 if there is an error: com.mysql.cj.jdbc.MysqlXAException: XAER_RMERR: Fatal error occurred in the transaction branch-check your data for consistency reason is atomikos solution score Error reporting solution for cloth transactions: add system permissions GRANT XA_RECOVER_ADMIN ON *. * TO base_sa@'%' to the account
3. Test the configuration file of the application
This is the end of spring: main: lazy-initialization: false jmx: enabled: false datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://xxxxxxxxxx:3307/sharding_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8 username: sharding password: sharding "what is the method of sharding-proxy docker packaging, deployment and testing". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 261
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.