# tinyurl **Repository Path**: zk99year/tinyurl ## Basic Information - **Project Name**: tinyurl - **Description**: 长链接生成短链接,高性能,高并发,高可用 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-06-21 - **Last Updated**: 2023-10-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # tinyurl ## 介绍 长链接生成短链接,高性能,高并发,高可用 ## 软件架构 软件架构说明: 使用Nacos动态配置和注册中心,用Dubbo提供RPC接口,使用ShardingSphere分库分表,使用Redis做缓存。 ## 安装教程 1. xxxx 2. xxxx 3. xxxx ## 使用说明 1. xxxx 2. xxxx 3. xxxx ## Git操作 **更新操作** 1、更新remote索引 ``` git fetch ``` **提交操作** 1、将当前目录下修改的所有代码从工作区添加到暂存区 ```git git add . ``` 2、将缓存区内容添加到本地仓库 ```git git commit -m "备注" ``` 3、将本地分支推送到origin主机,同时指定origin为默认主机,后面就可以不加任何参数使用git push 也可解决 git建立远程分支关联时出现fatal ... upstram的问题 ``` git push -u origin 分支名 ``` ## 配置文件 ### Service的配置 ```java # Nacos config nacos.config.server-addr=10.13.2.243:8848 nacos.config.namespace=d0ab2aef-91d1-4812-88e1-b09f124ecc89 nacos.config.data-id=service-config.properties nacos.config.group=tinyurl nacos.config.auto-refresh=true nacos.config.bootstrap.enable=true nacos.config.bootstrap.log-enable=true server.port=8091 spring.application.name=tinyurl-service spring.profiles.active=dev # Logback config logging.level.org.example=debug logging.file.path=./tinyurl-service/logs ## application dubbo.application.name = tinyurl-dubbo-provider ## Nacos registry address dubbo.registry.address = nacos://10.13.2.243:8848 dubbo.registry.parameters.namespace=d0ab2aef-91d1-4812-88e1-b09f124ecc89 ## Dubbo Protocol dubbo.protocol.name = dubbo dubbo.protocol.port = -1 # Provider @Service version tinyurl.service.version=1.0.0 tinyurl.service.name = tinyurlService dubbo.application.qosEnable=false # Sharding Sphere 配置 #配置数据库别名 spring.shardingsphere.datasource.names=db1,db2,db3,db4 #第一个数据库 库名:tiny_url_1 spring.shardingsphere.datasource.db1.type=com.alibaba.druid.pool.DruidDataSource spring.shardingsphere.datasource.db1.driver-class-name=com.mysql.cj.jdbc.Driver spring.shardingsphere.datasource.db1.url=jdbc:mysql://10.13.2.243:3306/tiny_url_1?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai spring.shardingsphere.datasource.db1.username=root spring.shardingsphere.datasource.db1.password=root #第二个数据库 库名:tiny_url_2 spring.shardingsphere.datasource.db2.type=com.alibaba.druid.pool.DruidDataSource spring.shardingsphere.datasource.db2.driver-class-name=com.mysql.cj.jdbc.Driver spring.shardingsphere.datasource.db2.url=jdbc:mysql://10.13.2.243:3306/tiny_url_2?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai spring.shardingsphere.datasource.db2.username=root spring.shardingsphere.datasource.db2.password=root #第三个数据库 库名:tiny_url_3 spring.shardingsphere.datasource.db3.type=com.alibaba.druid.pool.DruidDataSource spring.shardingsphere.datasource.db3.driver-class-name=com.mysql.cj.jdbc.Driver spring.shardingsphere.datasource.db3.url=jdbc:mysql://10.13.2.243:3306/tiny_url_3?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai spring.shardingsphere.datasource.db3.username=root spring.shardingsphere.datasource.db3.password=root #第四个数据库 库名:tiny_url_4 spring.shardingsphere.datasource.db4.type=com.alibaba.druid.pool.DruidDataSource spring.shardingsphere.datasource.db4.driver-class-name=com.mysql.cj.jdbc.Driver spring.shardingsphere.datasource.db4.url=jdbc:mysql://10.13.2.243:3306/tiny_url_4?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai spring.shardingsphere.datasource.db4.username=root spring.shardingsphere.datasource.db4.password=root #真实表 spring.shardingsphere.sharding.tables.tbl_url.actual-data-nodes=db$->{1..4}.tbl_url_$->{1..4} #分片(分表:table-strategy)策略 #分片键ID spring.shardingsphere.sharding.tables.tbl_url.table-strategy.standard.sharding-column=id #分表算法(需自己实现): spring.shardingsphere.sharding.tables.tbl_url.table-strategy.standard.precise-algorithm-class-name=org.example.tinyurl.algorithm.MyTablePreciseAlgorithm #表范围查询算法(需自己实现): spring.shardingsphere.sharding.tables.tbl_url.table-strategy.standard.range-algorithm-class-name=org.example.tinyurl.algorithm.MyTableRangeAlgorithm #分片(分库:database-strategy)策略 #分片键ID spring.shardingsphere.sharding.tables.tbl_url.database-strategy.standard.sharding-column=id #分库算法(需自己实现): spring.shardingsphere.sharding.tables.tbl_url.database-strategy.standard.precise-algorithm-class-name=org.example.tinyurl.algorithm.MyDBPreciseAlgorithm #库范围查找算法(需自己实现): spring.shardingsphere.sharding.tables.tbl_url.database-strategy.standard.range-algorithm-class-name=org.example.tinyurl.algorithm.MyDBRangeAlgorithm #显示sql语句 spring.shardingsphere.props.sql.show = true spring.main.allow-bean-definition-overriding=true # Mybatis Plus 配置 mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl # Redis 配置,redisson-sentinel 模式 redisson.masterName=mymaster redisson.schema=redis:// redisson.sentinelAddresses=10.13.2.243:26390,10.13.2.243:26391,10.13.2.243:26392 redisson.password= # RedisTemplate 配置 spring.redis.sentinel.master=mymaster spring.redis.sentinel.nodes=10.13.2.243:26390, 10.13.2.243:26391, 10.13.2.243:26392 ``` ## 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)