Summary of some precautions and problems in the use of Tars framework (mengxinxiang)

1. In terms of server size, if you want to use ECs to learn the tar framework, it is recommended that the memory should be at least 4G...

The subject uses docker + virtual network mode to deploy tars on the same server. The first deployment uses a 1-core 2G cloud server. After the deployment of docker three links (tars/node, tars/framework, mysql5.6), it is found that the server response is very slow by using the Xshell link. Sure enough, when the second example service HelloClient is launched, During the inspection, it was found that there was insufficient memory. After the subject was upgraded to 2-core 4G, the server exploded decisively when the third service was released and the release package was uploaded. Of course, there may be something wrong with my use. If a little partner can support it, please (kneel).

2. About link rejection

Problem Description:

HelloHttp has been successfully released, and the access path has been rejected. After checking docker, it is found that the port has been opened, the intranet cannot be connected, the internal access of the container still cannot be connected, Baidu has modified various network cards, and the configuration agent is still unable to succeed

Solution:

Be sure to test the service link first. If the link fails, the probability is the problem of the code, which is really important!!!

3. About the configuration of HelloHttp

The official configuration is as follows

In the actual development process, we are generally used to using

Generated pom file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.3.7.RELEASE</version>
                <configuration>
                    <mainClass>com.example.demo.DemoApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

At this time, adding the official configuration file will report an error, because the default generated template already contains the boot dependency, if you don't want to make too big changes

They are all small problems, but if you don't pay attention, it will really cause great trouble (it took me a day to find the wrong card). If you encounter problems, you can discuss them together. Finally, of course, it is successfully started ≥ โ—”โ—กโ—”≤

Keywords: Java

Added by koolswans on Thu, 20 Jan 2022 08:35:09 +0200