docker pull apache/shardingsphere-proxy:5.1.1
这里以5.1.1版本为例,更多版本可参见dockerhub
docker run -d \
-v /atguigu/server/proxy-a/conf:/opt/shardingsphere-proxy/conf \
-v /atguigu/server/proxy-a/ext-lib:/opt/shardingsphere-proxy/ext-lib \
-e ES_JAVA_OPTS="-Xmx256m -Xms256m -Xmn128m" \
-p 3321:3307 \
--name server-proxy-a \
apache/shardingsphere-proxy:5.1.1
mysql-connector-java-8.0.22.jar
驱动上传至/atguigu/server/proxy-a/ext-lib
目录下rules:
- !AUTHORITY
users:
- root@%:root
provider:
type: ALL_PRIVILEGES_PERMITTED
props:
sql-show: true
将配置文件放置在/atguigu/server/proxy-a/conf
目录下
(注意:这里的- !AUTHORITY
坚决不能删除,我擅自将其删除,导致shardingsphere-proxy
总是无法正常启动)
docker restart server-proxy-a
/opt/shardingsphere-proxy/logs/stdout.log
文件查看日志......
06:41:10.343 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true
06:41:10.343 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
06:41:10.384 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.processId: 38 (auto-detected)
06:41:10.386 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 02:42:ac:ff:fe:11:00:02 (auto-detected)
06:41:10.430 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
06:41:10.430 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
06:41:10.430 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
06:41:10.456 [epollEventLoopGroup-2-1] INFO io.netty.handler.logging.LoggingHandler - [id: 0xb34a76d5] REGISTERED
06:41:10.459 [epollEventLoopGroup-2-1] INFO io.netty.handler.logging.LoggingHandler - [id: 0xb34a76d5] BIND: 0.0.0.0/0.0.0.0:3307
06:41:10.461 [epollEventLoopGroup-2-1] INFO io.netty.handler.logging.LoggingHandler - [id: 0xb34a76d5, L:/0.0.0.0:3307] ACTIVE
06:41:10.462 [main] INFO org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy - ShardingSphere-Proxy Memory mode started successfully
有打印started successfully
则启动成功!
mysql -h 192.xxx.xxx.xxx -P 3321 -u root -p
show databases;
上述多数内容参考自尚硅谷,如有侵权,烦请联系将立刻删除