MyCat分片集群分表分库策略取模算法进行分库分表,主从备份

 MyCat分片集群分表分库策略

application.yml

spring:
  datasource:
    ###可读数据源
    select:
      jdbc-url: jdbc:mysql://192.168.184.129:8066/test
      driver-class-name: com.mysql.jdbc.Driver
      username: user
      password: 123456
    ####可写数据源  
    update:
      jdbc-url: jdbc:mysql://192.168.184.129:8066/test
      driver-class-name: com.mysql.jdbc.Driver
      username: root
      password: 123456
    type: com.alibaba.druid.pool.DruidDataSource
    
    
   

Controler的代码:

@RestController
public class UserController {

	@Autowired
	private UserService userService;

	@RequestMapping("/findUser")
	public List findUser() {
		return userService.findUser();
	}

	@RequestMapping("/insertUser")
	public List insertUser(String userName) {
		return userService.insertUser(userName);
	}
	@RequestMapping("/insert")
	public List insert () {
		UserEntity  user=new UserEntity()  ;
		for

你可能感兴趣的:(Mybatis,mysql,并发编程系列-高并发)