zk connection failed | mysql too many connections error

1, a problem portal-web initiation and direct communication channel micro distal occur.

问题:Will not attempt to authenticate using SASL (unknown error)

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-KgmDEHIz-1585376869542) (assets / 1583840477911.png)]

Resolution: The port did not write the zookeeper. Plus zk port 2181 just fine.
Here Insert Picture Description
It may be ecs and other server is not connected successfully.

2, mysql Connect too many errors

Method 1: Modify the file /etc/my.cnf

The max_connections = 5000 this value increases

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-UbxVM2QC-1585376869545) (assets / 1585206980733.png)]

Second way: using a data pool management connection

Dependent data pool springboot can be introduced directly into the project.

<!-- druid数据库连接池 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.10</version>
        </dependency>

The above two methods may be used in combination.

3, spring-boot project started, reported data source configuration errors, can not find the driver.

Problem: spring-boot to start the project in the following problems arise. Can not find driver[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-yKVbJZUR-1585376869547) (assets / 1584018856517.png)]

wrong reason:

There are dependencies of the dependent mybatis-plus.

The need to rely on the default configuration of the data source.

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-QeWEk5Ox-1585376869549) (assets / 1584019185813.png)]

solution:

Scheme One: the configuration about the data source connection configuration

spring:
  datasource:
    url: jdbc:mysql://47.94.22.256:3306/ego-shop
    username: root
    password: 123456
    driver-class-name: com.mysql.cj.jdbc.Driver
mybatis-plus:
  type-aliases-package: com.zxm.entity
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  mapper-locations: classpath:/mapper/*.xml

Option II: Use annotations exclude data source class start

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-l7Ap6xBt-1585376869550) (assets / 1584019098651.png)]

4, the project can not rely on random write

In a remote call, just rely on search-api. We can not rely indiscriminately.

If you rely on a search-service you will get the configuration file in the dependency. In the absence of the notes in the portal-web @Value("${import.size}")to get the value in the configuration file, so the project will start being given.

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-zz8dwIlD-1585376869551) (assets / 1584085277102.png)]
Here Insert Picture Description

Published 29 original articles · won praise 0 · Views 2236

Guess you like

Origin blog.csdn.net/rootDream/article/details/105160809