DockerCompose+SpringBoot+Nginx+Mysql实践

DockerCompose+SpringBoot+Nginx+Mysql实践

1、Spring Boot案例

首先我们先准备一个 Spring Boot 使用 Mysql 的小场景,我们做这样一个示例,使用 Spring Boot 做一个 Web 应

用,提供一个按照 IP 地址统计访问次数的方法,每次请求时将统计数据存入 Mysql 并展示到页面中。

1.1 pom依赖

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.neo</groupId>
    <artifactId>dockercompose-springboot-mysql-nginx</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>dockercompose-springboot-mysql-nginx</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.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-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <defaultGoal>compile</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

主要添加了 Spring Boot Web 支持,使用 Jpa 操作数据库、添加 Myql 驱动包等。

1.2 配置文件

application.properties

spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql=true

spring.profiles.active=dev
server.port=8090

application-dev.properties

spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8090

application-docker.properties

spring.datasource.url=jdbc:mysql://mysql:3306/test
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8090

配置了数据库的链接信息,以及 Jpa 更新表模式、方言和是否显示Sql。

1.3 核心代码

核心代码很简单,每过来一个请求,判断是否已经统计过,如果没有统计新增数据,如果有统计数据更新数据。

package com.neo.controller;

import com.neo.entity.Visitor;
import com.neo.repository.VisitorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class VisitorController {

    @Autowired
    private VisitorRepository repository;

    @RequestMapping("/")
    public String index(HttpServletRequest request) {
        String ip = request.getRemoteAddr();
        Visitor visitor = repository.findByIp(ip);
        if (visitor == null) {
            visitor = new Visitor();
            visitor.setIp(ip);
            visitor.setTimes(1);
        } else {
            visitor.setTimes(visitor.getTimes() + 1);
        }
        repository.save(visitor);
        return "I have been seen ip " + visitor.getIp() + " " + visitor.getTimes() + " times.";
    }
}

实体类和 Repository 层代码比较简单。

package com.neo.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class Visitor {
    @Id
    @GeneratedValue
    private long id;
    @Column(nullable = false)
    private long times;
    @Column(nullable = false)
    private String ip;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getTimes() {
        return times;
    }

    public void setTimes(long times) {
        this.times = times;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }
}
package com.neo.repository;

import com.neo.entity.Visitor;
import org.springframework.data.jpa.repository.JpaRepository;

public interface  VisitorRepository extends JpaRepository<Visitor, Long> {
    Visitor findByIp(String ip);
}
package com.neo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ComposeApplication {

    public static void main(String[] args) {
        SpringApplication.run(ComposeApplication.class, args);
    }
}

以上内容都完成后,启动项目,访问:http://localhost:8090/ 我们就可以看到这样的返回结果:

I have been seen ip 0:0:0:0:0:0:0:1 1 times.

再访问一次会变成

I have been seen ip 0:0:0:0:0:0:0:1 2 times.

多次访问一直叠加,说明演示项目开发完成。

2、Docker化改造

首先我们将目录改造成这样一个结构

在这里插入图片描述

我们先从最外层说起:

  • docker-compose.yaml:docker-compose 的核心文件,描述如何构建整个服务。

  • nginx:有关 nginx 的配置。

  • app:Spring Boot 项目地址。

如果我们需要对 Mysql 有特殊的定制,也可以在最外层创建 mysql 文件夹,在此目录下进行配置。

2.1 docker-compose.yaml 文件详解

version: '3'
services:
  nginx:
    container_name: v-nginx
    image: nginx:1.13
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d

  mysql:
    container_name: v-mysql
    image: mysql/mysql-server:5.7
    environment:
      MYSQL_DATABASE: test
      MYSQL_ROOT_PASSWORD: root
      MYSQL_ROOT_HOST: '%'
    ports:
      - "3306:3306"
    restart: always

  app:
    container_name: app
    restart: always
    build: ./app
    working_dir: /app
    volumes:
      - ./app:/app
      - /home/zhangshixing/maven/m2:/root/.m2
    expose:
      - "8090"
    depends_on:
      - nginx
      - mysql
    command: mvn clean spring-boot:run -Dspring-boot.run.profiles=docker
  • version: '3': 表示使用第三代语法来构建 docker-compose.yaml 文件。

  • services:用来表示 compose 需要启动的服务,我们可以看出此文件中有三个服务分别为:nginx、

    mysql、app。

  • container_name:容器名称

  • environment:此节点下的信息会当作环境变量传入容器,此示例中 mysql 服务配置了数据库、密码和权限

    信息。

  • ports:表示对外开放的端口

  • restart: always:表示如果服务启动不成功会一直尝试。

  • volumes:加载本地目录下的配置文件到容器目标地址下

  • depends_on:可以配置依赖服务,表示需要先启动 depends_on 下面的服务后,再启动本服务。

  • command: mvn clean spring-boot:run -Dspring-boot.run.profiles=docker :表示以这个命令来启

    动项目,-Dspring-boot.run.profiles=docker表示使用 application-docker.properties文件配置信

    息进行启动。

2.2 Nginx 文件解读

nginx 在目录下有一个文件 app.conf,主要配置了服务转发信息。

server {
    listen 80;
    charset utf-8;
    access_log off;

    location / {
        proxy_pass http://app:8090;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /static {
        access_log   off;
        expires      30d;

        alias /app/static;
    }
}

这块内容比较简单,配置请求转发,将80端口的请求转发到服务 app 的8090端口。其中proxy_pass

http://app:8090这块的配置信息。

需要解释一下,这里使用是app而不是localhost,是因为他们没有在一个容器中,在一组 compose 的服务通

讯需要使用 services 的名称进行访问。

2.3 Spring Boot 项目改造

app目录下也就是和pom.xm文件同级添加Dockerfile文件,文件内容如下:

FROM maven:3.5-jdk-8

只有一句,依赖于基础镜像maven3.5jdk1.8。因为在docker-compose.yaml文件设置了项目启动命令,这

里不需要再添加启动命令。

在项目的resources目录下创建application-dev.propertiesapplication-docker.properties文件

  • application-dev.properties 中的配置信息和上面一致

  • application-docker.properties 中的配置信息做稍微的改造,将数据库的连接信息由

    jdbc:mysql://localhost:3306/test改为jdbc:mysql://mysql:3306/test

这样我们所有的配置都已经完成。

2.4 部署

我们将项目拷贝到服务器中进行测试,服务器需要先安装 Docker 和 Docker Compos 环境。

将项目拷贝到服务器中,进入目录:cd dockercompose-springboot-mysql-nginx

启动服务:docker-compose up

[root@zsx dockercompose-springboot-mysql-nginx]# docker-compose up
[+] Running 4/4
 ⠿ Network dockercompose-springboot-mysql-nginx_default  Created                                                               0.2s
 ⠿ Container v-mysql                                     Created                                                               0.1s
 ⠿ Container v-nginx                                     Created                                                               0.1s
 ⠿ Container app                                         Created                                                               0.3s
Attaching to app, v-mysql, v-nginx
v-mysql  | [Entrypoint] MySQL Docker Image 5.7.41-1.2.11-server
v-mysql  | [Entrypoint] Initializing database
v-mysql  | 2024-01-28T04:06:28.932555Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
v-mysql  | 2024-01-28T04:06:29.181788Z 0 [Warning] InnoDB: New log files created, LSN=45790
v-mysql  | 2024-01-28T04:06:29.273310Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
v-mysql  | 2024-01-28T04:06:29.408225Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9d205946-bd92-11ee-a298-0242ac120003.
v-mysql  | 2024-01-28T04:06:29.416618Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
v-mysql  | 2024-01-28T04:06:29.767946Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
v-mysql  | 2024-01-28T04:06:29.770248Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
v-mysql  | 2024-01-28T04:06:29.770782Z 0 [Warning] CA certificate ca.pem is self signed.
v-mysql  | 2024-01-28T04:06:29.825640Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
app      | [INFO] Scanning for projects...
app      | [INFO]
app      | [INFO] ------------< com.neo:dockercompose-springboot-mysql-nginx >------------
app      | [INFO] Building dockercompose-springboot-mysql-nginx 1.0
app      | [INFO] --------------------------------[ jar ]---------------------------------
app      | [INFO]
app      | [INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ dockercompose-springboot-mysql-nginx ---
app      | [INFO] Deleting /app/target
app      | [INFO]
app      | [INFO] >>> spring-boot-maven-plugin:2.0.0.RELEASE:run (default-cli) > test-compile @ dockercompose-springboot-mysql-nginx >>>
app      | [INFO]
app      | [INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ dockercompose-springboot-mysql-nginx ---
app      | [INFO] Using 'UTF-8' encoding to copy filtered resources.
app      | [INFO] Copying 3 resources
app      | [INFO] Copying 0 resource
app      | [INFO]
app      | [INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ dockercompose-springboot-mysql-nginx ---
app      | [INFO] Changes detected - recompiling the module!
app      | [INFO] Compiling 4 source files to /app/target/classes
app      | [INFO]
app      | [INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ dockercompose-springboot-mysql-nginx ---
app      | [INFO] Using 'UTF-8' encoding to copy filtered resources.
app      | [INFO] skip non existing resourceDirectory /app/src/test/resources
app      | [INFO]
app      | [INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ dockercompose-springboot-mysql-nginx ---
app      | [INFO] Nothing to compile - all classes are up to date
app      | [INFO]
app      | [INFO] <<< spring-boot-maven-plugin:2.0.0.RELEASE:run (default-cli) < test-compile @ dockercompose-springboot-mysql-nginx <<<
app      | [INFO]
app      | [INFO]
app      | [INFO] --- spring-boot-maven-plugin:2.0.0.RELEASE:run (default-cli) @ dockercompose-springboot-mysql-nginx ---
v-mysql  | [Entrypoint] Database initialized
v-mysql  | 2024-01-28T04:06:36.934640Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
v-mysql  | 2024-01-28T04:06:36.935929Z 0 [Note] mysqld (mysqld 5.7.41) starting as process 50 ...
v-mysql  | 2024-01-28T04:06:36.947967Z 0 [Note] InnoDB: PUNCH HOLE support available
v-mysql  | 2024-01-28T04:06:36.947993Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
v-mysql  | 2024-01-28T04:06:36.947996Z 0 [Note] InnoDB: Uses event mutexes
v-mysql  | 2024-01-28T04:06:36.947999Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
v-mysql  | 2024-01-28T04:06:36.948001Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
v-mysql  | 2024-01-28T04:06:36.948003Z 0 [Note] InnoDB: Using Linux native AIO
v-mysql  | 2024-01-28T04:06:36.948198Z 0 [Note] InnoDB: Number of pools: 1
v-mysql  | 2024-01-28T04:06:36.948282Z 0 [Note] InnoDB: Using CPU crc32 instructions
v-mysql  | 2024-01-28T04:06:36.960215Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
v-mysql  | 2024-01-28T04:06:36.994304Z 0 [Note] InnoDB: Completed initialization of buffer pool
v-mysql  | 2024-01-28T04:06:36.996097Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
v-mysql  | 2024-01-28T04:06:37.009968Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
v-mysql  | 2024-01-28T04:06:37.062369Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
v-mysql  | 2024-01-28T04:06:37.062444Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
v-mysql  | 2024-01-28T04:06:37.109205Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
v-mysql  | 2024-01-28T04:06:37.109985Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
v-mysql  | 2024-01-28T04:06:37.109993Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
v-mysql  | 2024-01-28T04:06:37.110223Z 0 [Note] InnoDB: Waiting for purge to start
v-mysql  | 2024-01-28T04:06:37.166911Z 0 [Note] InnoDB: 5.7.41 started; log sequence number 2762314
v-mysql  | 2024-01-28T04:06:37.167162Z 0 [Note] Plugin 'FEDERATED' is disabled.
v-mysql  | 2024-01-28T04:06:37.176325Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
v-mysql  | 2024-01-28T04:06:37.176340Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
v-mysql  | 2024-01-28T04:06:37.176344Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
v-mysql  | 2024-01-28T04:06:37.176346Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
v-mysql  | 2024-01-28T04:06:37.177082Z 0 [Warning] CA certificate ca.pem is self signed.
v-mysql  | 2024-01-28T04:06:37.177140Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
v-mysql  | 2024-01-28T04:06:37.178061Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
v-mysql  | 2024-01-28T04:06:37.179303Z 0 [Note] InnoDB: Buffer pool(s) load completed at 240128  4:06:37
v-mysql  | 2024-01-28T04:06:37.218314Z 0 [Note] Event Scheduler: Loaded 0 events
v-mysql  | 2024-01-28T04:06:37.218444Z 0 [Note] mysqld: ready for connections.
v-mysql  | Version: '5.7.41'  socket: '/var/lib/mysql/mysql.sock'  port: 0  MySQL Community Server (GPL)
v-mysql  | 2024-01-28T04:06:37.291814Z 3 [Note] InnoDB: Stopping purge
v-mysql  | 2024-01-28T04:06:37.300043Z 3 [Note] InnoDB: Resuming purge
v-mysql  | 2024-01-28T04:06:37.317607Z 3 [Note] InnoDB: Stopping purge
v-mysql  | 2024-01-28T04:06:37.333861Z 3 [Note] InnoDB: Resuming purge
v-mysql  | 2024-01-28T04:06:37.348331Z 3 [Note] InnoDB: Stopping purge
v-mysql  | 2024-01-28T04:06:37.402247Z 3 [Note] InnoDB: Resuming purge
v-mysql  | 2024-01-28T04:06:37.440636Z 3 [Note] InnoDB: Stopping purge
v-mysql  | 2024-01-28T04:06:37.463372Z 3 [Note] InnoDB: Resuming purge
v-mysql  | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
v-mysql  | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
app      |
app      |   .   ____          _            __ _ _
app      |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
app      | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
app      |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
app      |   '  |____| .__|_| |_|_| |_\__, | / / / /
app      |  =========|_|==============|___/=/_/_/_/
app      |  :: Spring Boot ::        (v2.0.0.RELEASE)
app      |
app      | 2024-01-28 04:06:42.640  INFO 1 --- [           main] com.neo.ComposeApplication               : Starting ComposeApplication on 5a1fd4d2cc5a with PID 1 (/app/target/classes started by root in /app)
app      | 2024-01-28 04:06:42.664  INFO 1 --- [           main] com.neo.ComposeApplication               : The following profiles are active: docker
v-mysql  | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
v-mysql  | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
v-mysql  | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
v-mysql  |
v-mysql  | [Entrypoint] ignoring /docker-entrypoint-initdb.d/*
v-mysql  |
v-mysql  | 2024-01-28T04:06:43.208244Z 0 [Note] Giving 0 client threads a chance to die gracefully
v-mysql  | 2024-01-28T04:06:43.208267Z 0 [Note] Shutting down slave threads
v-mysql  | 2024-01-28T04:06:43.208275Z 0 [Note] Forcefully disconnecting 0 remaining clients
v-mysql  | 2024-01-28T04:06:43.208281Z 0 [Note] Event Scheduler: Purging the queue. 0 events
v-mysql  | 2024-01-28T04:06:43.208699Z 0 [Note] Binlog end
v-mysql  | 2024-01-28T04:06:43.209084Z 0 [Note] Shutting down plugin 'ngram'
v-mysql  | 2024-01-28T04:06:43.209092Z 0 [Note] Shutting down plugin 'partition'
v-mysql  | 2024-01-28T04:06:43.209094Z 0 [Note] Shutting down plugin 'BLACKHOLE'
v-mysql  | 2024-01-28T04:06:43.209097Z 0 [Note] Shutting down plugin 'ARCHIVE'
v-mysql  | 2024-01-28T04:06:43.209099Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
v-mysql  | 2024-01-28T04:06:43.209121Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
v-mysql  | 2024-01-28T04:06:43.209125Z 0 [Note] Shutting down plugin 'MyISAM'
v-mysql  | 2024-01-28T04:06:43.209132Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
v-mysql  | 2024-01-28T04:06:43.209135Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
v-mysql  | 2024-01-28T04:06:43.209137Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
v-mysql  | 2024-01-28T04:06:43.209139Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
v-mysql  | 2024-01-28T04:06:43.209141Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
v-mysql  | 2024-01-28T04:06:43.209142Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
v-mysql  | 2024-01-28T04:06:43.209144Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
v-mysql  | 2024-01-28T04:06:43.209146Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
v-mysql  | 2024-01-28T04:06:43.209148Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
v-mysql  | 2024-01-28T04:06:43.209149Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
v-mysql  | 2024-01-28T04:06:43.209151Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
v-mysql  | 2024-01-28T04:06:43.209153Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
v-mysql  | 2024-01-28T04:06:43.209154Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
v-mysql  | 2024-01-28T04:06:43.209156Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
v-mysql  | 2024-01-28T04:06:43.209158Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
v-mysql  | 2024-01-28T04:06:43.209160Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
v-mysql  | 2024-01-28T04:06:43.209161Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
v-mysql  | 2024-01-28T04:06:43.209163Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
v-mysql  | 2024-01-28T04:06:43.209165Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
v-mysql  | 2024-01-28T04:06:43.209167Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
v-mysql  | 2024-01-28T04:06:43.209169Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
v-mysql  | 2024-01-28T04:06:43.209170Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
v-mysql  | 2024-01-28T04:06:43.209172Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
v-mysql  | 2024-01-28T04:06:43.209174Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
v-mysql  | 2024-01-28T04:06:43.209176Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
v-mysql  | 2024-01-28T04:06:43.209178Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
v-mysql  | 2024-01-28T04:06:43.209179Z 0 [Note] Shutting down plugin 'INNODB_CMP'
v-mysql  | 2024-01-28T04:06:43.209181Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
v-mysql  | 2024-01-28T04:06:43.209183Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
v-mysql  | 2024-01-28T04:06:43.209184Z 0 [Note] Shutting down plugin 'INNODB_TRX'
v-mysql  | 2024-01-28T04:06:43.209186Z 0 [Note] Shutting down plugin 'InnoDB'
v-mysql  | 2024-01-28T04:06:43.209230Z 0 [Note] InnoDB: FTS optimize thread exiting.
v-mysql  | 2024-01-28T04:06:43.209911Z 0 [Note] InnoDB: Starting shutdown...
app      | 2024-01-28 04:06:43.222  INFO 1 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@301dca64: startup date [Sun Jan 28 04:06:43 UTC 2024]; root of context hierarchy
v-mysql  | 2024-01-28T04:06:43.311419Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
v-mysql  | 2024-01-28T04:06:43.311649Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 240128  4:06:43
v-mysql  | 2024-01-28T04:06:45.025243Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12184554
v-mysql  | 2024-01-28T04:06:45.029495Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
v-mysql  | 2024-01-28T04:06:45.029524Z 0 [Note] Shutting down plugin 'MEMORY'
v-mysql  | 2024-01-28T04:06:45.029554Z 0 [Note] Shutting down plugin 'CSV'
v-mysql  | 2024-01-28T04:06:45.029560Z 0 [Note] Shutting down plugin 'sha256_password'
v-mysql  | 2024-01-28T04:06:45.029563Z 0 [Note] Shutting down plugin 'mysql_native_password'
v-mysql  | 2024-01-28T04:06:45.029660Z 0 [Note] Shutting down plugin 'binlog'
v-mysql  | 2024-01-28T04:06:45.031085Z 0 [Note] mysqld: Shutdown complete
v-mysql  |
v-mysql  | [Entrypoint] Server shut down
v-mysql  |
v-mysql  | [Entrypoint] MySQL init process done. Ready for start up.
v-mysql  |
v-mysql  | [Entrypoint] Starting MySQL 5.7.41-1.2.11-server
v-mysql  | 2024-01-28T04:06:45.507704Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
v-mysql  | 2024-01-28T04:06:45.509088Z 0 [Note] mysqld (mysqld 5.7.41) starting as process 1 ...
v-mysql  | 2024-01-28T04:06:45.516922Z 0 [Note] InnoDB: PUNCH HOLE support available
v-mysql  | 2024-01-28T04:06:45.516954Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
v-mysql  | 2024-01-28T04:06:45.516958Z 0 [Note] InnoDB: Uses event mutexes
v-mysql  | 2024-01-28T04:06:45.516961Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
v-mysql  | 2024-01-28T04:06:45.516964Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
v-mysql  | 2024-01-28T04:06:45.516968Z 0 [Note] InnoDB: Using Linux native AIO
v-mysql  | 2024-01-28T04:06:45.517232Z 0 [Note] InnoDB: Number of pools: 1
v-mysql  | 2024-01-28T04:06:45.517330Z 0 [Note] InnoDB: Using CPU crc32 instructions
v-mysql  | 2024-01-28T04:06:45.518750Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
v-mysql  | 2024-01-28T04:06:45.536989Z 0 [Note] InnoDB: Completed initialization of buffer pool
v-mysql  | 2024-01-28T04:06:45.538826Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
v-mysql  | 2024-01-28T04:06:45.550984Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
v-mysql  | 2024-01-28T04:06:45.600284Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
v-mysql  | 2024-01-28T04:06:45.600371Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
v-mysql  | 2024-01-28T04:06:45.624539Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
v-mysql  | 2024-01-28T04:06:45.625242Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
v-mysql  | 2024-01-28T04:06:45.625253Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
v-mysql  | 2024-01-28T04:06:45.625514Z 0 [Note] InnoDB: Waiting for purge to start
v-mysql  | 2024-01-28T04:06:45.677312Z 0 [Note] InnoDB: 5.7.41 started; log sequence number 12184554
v-mysql  | 2024-01-28T04:06:45.677578Z 0 [Note] Plugin 'FEDERATED' is disabled.
v-mysql  | 2024-01-28T04:06:45.682869Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
v-mysql  | 2024-01-28T04:06:45.682882Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
v-mysql  | 2024-01-28T04:06:45.682886Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
v-mysql  | 2024-01-28T04:06:45.682888Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
v-mysql  | 2024-01-28T04:06:45.686229Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
v-mysql  | 2024-01-28T04:06:45.700961Z 0 [Warning] CA certificate ca.pem is self signed.
v-mysql  | 2024-01-28T04:06:45.701031Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
v-mysql  | 2024-01-28T04:06:45.701413Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
v-mysql  | 2024-01-28T04:06:45.701481Z 0 [Note] IPv6 is available.
v-mysql  | 2024-01-28T04:06:45.701506Z 0 [Note]   - '::' resolves to '::';
v-mysql  | 2024-01-28T04:06:45.701526Z 0 [Note] Server socket created on IP: '::'.
v-mysql  | 2024-01-28T04:06:45.703079Z 0 [Note] InnoDB: Buffer pool(s) load completed at 240128  4:06:45
v-mysql  | 2024-01-28T04:06:45.750076Z 0 [Note] Event Scheduler: Loaded 0 events
v-mysql  | 2024-01-28T04:06:45.750210Z 0 [Note] mysqld: ready for connections.
v-mysql  | Version: '5.7.41'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
app      | 2024-01-28 04:06:45.863  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$ddc5732] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
app      | 2024-01-28 04:06:46.407  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8090 (http)
app      | 2024-01-28 04:06:46.493  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
app      | 2024-01-28 04:06:46.494  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.28
app      | 2024-01-28 04:06:46.511  INFO 1 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
app      | 2024-01-28 04:06:46.758  INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
app      | 2024-01-28 04:06:46.759  INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3563 ms
app      | 2024-01-28 04:06:47.011  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
app      | 2024-01-28 04:06:47.014  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
app      | 2024-01-28 04:06:47.025  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
app      | 2024-01-28 04:06:47.025  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
app      | 2024-01-28 04:06:47.025  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
app      | 2024-01-28 04:06:47.411  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
app      | Sun Jan 28 04:06:47 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:48.144546Z 2 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | 2024-01-28 04:06:48.229  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
app      | Sun Jan 28 04:06:48 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
app      | 2024-01-28 04:06:48.390  INFO 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
v-mysql  | 2024-01-28T04:06:48.429374Z 3 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | 2024-01-28 04:06:48.450  INFO 1 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
app      |      name: default
app      |      ...]
app      | Sun Jan 28 04:06:48 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:48.516220Z 4 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | Sun Jan 28 04:06:48 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:48.579164Z 5 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | Sun Jan 28 04:06:48 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:48.630329Z 6 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | Sun Jan 28 04:06:48 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
app      | 2024-01-28 04:06:48.686  INFO 1 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.14.Final}
app      | 2024-01-28 04:06:48.687  INFO 1 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
v-mysql  | 2024-01-28T04:06:48.696303Z 7 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | Sun Jan 28 04:06:48 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:48.760458Z 8 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | 2024-01-28 04:06:48.797  INFO 1 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
app      | Sun Jan 28 04:06:48 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:48.845433Z 9 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | Sun Jan 28 04:06:49 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:49.049553Z 10 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | Sun Jan 28 04:06:49 UTC 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
v-mysql  | 2024-01-28T04:06:49.106481Z 11 [Warning] Accepted a connection with deprecated protocol 'TLSv1.1' for account `root`@`%` from host `172.18.0.4`. Client supplied username `root`
app      | 2024-01-28 04:06:49.236  INFO 1 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
app      | Hibernate: create table hibernate_sequence (next_val bigint) engine=InnoDB
app      | Hibernate: insert into hibernate_sequence values ( 1 )
app      | Hibernate: create table visitor (id bigint not null, ip varchar(255) not null, times bigint not null, primary key (id)) engine=InnoDB
app      | 2024-01-28 04:06:50.312  INFO 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
app      | 2024-01-28 04:06:52.119  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@301dca64: startup date [Sun Jan 28 04:06:43 UTC 2024]; root of context hierarchy
app      | 2024-01-28 04:06:52.213  WARN 1 --- [           main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
app      | 2024-01-28 04:06:52.283  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public java.lang.String com.neo.controller.VisitorController.index(javax.servlet.http.HttpServletRequest)
app      | 2024-01-28 04:06:52.294  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
app      | 2024-01-28 04:06:52.294  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
app      | 2024-01-28 04:06:52.358  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
app      | 2024-01-28 04:06:52.364  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
app      | 2024-01-28 04:06:52.431  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
app      | 2024-01-28 04:06:52.826  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
app      | 2024-01-28 04:06:52.827  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'dataSource' has been autodetected for JMX exposure
app      | 2024-01-28 04:06:52.849  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
app      | 2024-01-28 04:06:53.015  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8090 (http) with context path ''
app      | 2024-01-28 04:06:53.030  INFO 1 --- [           main] com.neo.ComposeApplication               : Started ComposeApplication in 13.495 seconds (JVM running for 23.292)
app      | 2024-01-28 04:07:05.300  INFO 1 --- [nio-8090-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
app      | 2024-01-28 04:07:05.301  INFO 1 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
app      | 2024-01-28 04:07:05.329  INFO 1 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 28 ms
app      | 2024-01-28 04:07:05.435  INFO 1 --- [nio-8090-exec-1] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
app      | Hibernate: select visitor0_.id as id1_0_, visitor0_.ip as ip2_0_, visitor0_.times as times3_0_ from visitor visitor0_ where visitor0_.ip=?
app      | Hibernate: select next_val as id_val from hibernate_sequence for update
app      | Hibernate: update hibernate_sequence set next_val= ? where next_val=?
app      | Hibernate: insert into visitor (ip, times, id) values (?, ?, ?)

看到信息Tomcat initialized with port(s): 8090 (http)表示服务启动成功。

也可以使用docker-compose up -d后台启动:

[root@zsx dockercompose-springboot-mysql-nginx]# docker-compose up -d
[+] Running 3/3
 ⠿ Container v-nginx  Started                                                                                                  0.8s
 ⠿ Container v-mysql  Started                                                                                                  0.7s
 ⠿ Container app      Started                                                                                                  1.6s

访问服务器地址:http://192.168.136.195/,返回:I have been seen ip 172.19.0.2 1 times.

表示整体服务启动成功。

使用docker-compose ps查看项目中目前的所有容器:

[root@zsx dockercompose-springboot-mysql-nginx]# docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED         STATUS                             PORTS                                                                      NAMES
5a1fd4d2cc5a   dockercompose-springboot-mysql-nginx-app   "/usr/local/bin/mvn-…"   3 minutes ago   Up 24 seconds                      8090/tcp                                                                   app
576607ed0dda   mysql/mysql-server:5.7                     "/entrypoint.sh mysq…"   3 minutes ago   Up 25 seconds (health: starting)   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp                       v-mysql
11ae3ff42704   nginx:1.13                                 "nginx -g 'daemon of…"   3 minutes ago   Up 25 seconds                      0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   v-nginx

可以看到项目中服务的状态、命令、端口等信息。

关闭服务docker-compose down

[root@zsx dockercompose-springboot-mysql-nginx]# docker-compose down
[+] Running 4/4
 ⠿ Container app                                         Removed                                                                                                                                                 0.3s
 ⠿ Container v-mysql                                     Removed                                                                                                                                                 3.9s
 ⠿ Container v-nginx                                     Removed                                                                                                                                                 0.2s
 ⠿ Network dockercompose-springboot-mysql-nginx_default  Removed            

2.5 docker-compose 顺序

在使用 docker-compose 启动的时候经常会出现项目报 Mysql 连接异常,跟踪了一天终于发现了问题。 docker-

compose 虽然可以通过depends_on 来定义服务启动的顺序,但是无法确定服务是否启动完成,因此会出现这

样一个现象,Mysql 服务启动比较慢,当 Spring Boot 项目已经启动起来,但是 Mysql 还没有初始化好,这样当

项目连接 Mysql 数据库的时候,就会出现连接数据库的异常。

针对这样的问题,有两种解决方案:

1、足够的容错和重试机制,比如连接数据库,在初次连接不上的时候,服务消费者可以不断重试,直到连接上服

务。也就是在服务中定义: restart: always

2、同步等待,使用wait-for-it.sh或者其他shell脚本将当前服务启动阻塞,直到被依赖的服务加载完毕。这

种方案后期可以尝试使用。

3、总结

没有对比就没有伤害,在没有使用 Docker 之前,我们需要搭建这样一个环境的话,需要安装 Nginx、Mysql ,再

进行一系列的配置调试,还要担心各种环境问题;使用 Docker 之后简单两个命令就完成服务的上线、下线。

# 初始化并启动容器
$ docker-compose up
# 停止容器并且删除容器
$ docker-compose down
# 停止容器
$ docker-compose stop
# 启动容器
$ docker-compose start

其实容器技术对部署运维的优化还有很多,这只是刚刚开始,后面使用了 Swarm 才会真正感受到它的便利和强

大。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/368285.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【C语言/基础梳理/期末复习】动态内存管理(附思维导图)

目录 一、为什么要有动态内存分配 &#xff08;1&#xff09;我们已经掌握的内存方式的特点 &#xff08;2&#xff09;需求 二、malloc和free 2.1.malloc 2.1.1函数原型 2.1.2函数使用 2.1.3应用示例​编辑 2.2free 2.2.1函数原型 2.2.2函数使用 三、calloc和reallo…

Vue3 - 从 vue2 到 vue3 过渡,这一套就够了(案例 + 效果演示)(二)

目录 一、组合式 API 的使用 1.1、watch 函数 1.2、watchEffect 函数 1.3、toRef 和 toRefs 1.3.1、toRef 1.3.2、toRefs 1.4、vue3 的声明周期 一、组合式 API 的使用 1.1、watch 函数 与 vue2.x 中的 watch 配置功能一致&#xff0c;但是多了一些坑&#xff1a; 这…

计算机设计大赛 深度学习 YOLO 实现车牌识别算法

文章目录 0 前言1 课题介绍2 算法简介2.1网络架构 3 数据准备4 模型训练5 实现效果5.1 图片识别效果5.2视频识别效果 6 部分关键代码7 最后 0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; 基于yolov5的深度学习车牌识别系统实现 该项目较…

platform总线

1、平台总线模型 平台总线模型是Linux系统虚拟出来的总线&#xff0c;而I2C、SPI等物理总线是真实存在的。 平台总线模型将一个驱动分成两个部分&#xff0c;分别是device.c和driver.c&#xff0c;分别用来描述硬件信息和控制硬件。 平台总线通过字符串比较&#xff0c;将name…

MySQL数据库①_MySQL入门(概念+使用)

目录 1. 数据库的概念 1.1 数据库的存储介质 1.2 主流数据库 2. MySQL的基本使用 2.1 链接数据库 2.2 服务器管理 2.3 数据库&#xff0c;服务器和表关系 2.4 简单MySQL语句 3. MySQL架构 4. SQL分类 5. 存储引擎 本篇完。 1. 数据库的概念 数据库是按照数据结构来…

蓝桥杯备战——12.PCF8591芯片的使用

目录 1.芯片简介2.读写时序3.控制字4.代码封装库5.原理图分析6.使用示例 1.芯片简介 截取自NXP的PCF8591芯片数据手册&#xff0c;我把重点关注部分划出来了&#xff0c;请务必自行阅读一遍数据手册&#xff01; 2.读写时序 ①器件地址&#xff1a; Bit0决定是读还是写操作&…

阳光倒灌光催化太阳光(太阳能)模拟器

太阳光&#xff08;太阳能&#xff09;模拟器是一种模拟太阳光照射的设备。由于太阳模拟器本身体积较小&#xff0c;测试过程不受环境、气候、时间等因素影响&#xff0c;从而避免了室外测量的各种因素限制&#xff0c;广泛应用于太阳能电池特性测试&#xff0c;光电材料特性测…

数学建模比赛期间,网上的各种思路靠谱吗

美赛第二天&#xff0c;很多人已经撑不住了。 从昨天起网上就那么多“思路”、“指导”、“代做”、“成品论文”&#xff0c;有免费的&#xff0c;也有收钱的。 有人说那些思路都是滥竽充数&#xff0c;纯坑钱浪费时间 有人说自己啥都不会&#xff0c;看那些思路就有启发 有…

一些你可能用到的函数和头文件

对于排序想必大家应该挺熟悉的&#xff0c;如果要是给一连串打乱的整数让你由小到大排序&#xff0c;常见的方法有冒泡排序法和选择排序法等&#xff0c;今天我就给大家介绍一个十分好用的方法&#xff0c;就是使用 sort 函数来进行快排。 sort 函数是位于头文件 #include <…

正点原子--STM32定时器学习笔记(2)

书接上文&#xff0c;本篇是对基本定时器实验部分进行的总结~ 实验目标&#xff1a;通过TIM6基本定时器定时500ms&#xff0c;让LED0每隔500ms闪烁。 解决思路&#xff1a;使用定时器6&#xff0c;实现500ms产生一次定时器更新中断&#xff0c;在中断里执行“翻转LED0”。 定时…

其他发现:开源数据可视化分析工具DataEase介绍文档

一、 简介 DataEase 是开源的数据可视化分析工具&#xff0c;帮助用户快速分析数据并洞察业务趋势&#xff0c;从而实现业务的改进与优化。DataEase 支持丰富的数据源连接&#xff0c;能够通过拖拉拽方式快速制作图表&#xff0c;并可以方便地与他人分享。 二、 优势 1、 开…

MySQL-----DML基础操作

DML语句 DML英文全称是Data Manipulation Language(数据操作语言)&#xff0c;用来对数据库中表的数据记录进行增删改操作。 ▶ 添加数据(INSERT) 【语法】 1. 给指定字段添加数据 INSERTO 表名 (字段名1&#xff0c;字段名2,...) VALUES (值1&#xff0c;值2,...); 2.给全…

npm install一直报错 failed, reason: certificate has expired

刚开始我以为是taobao镜像源的问题&#xff0c;所以我把npm的地址切换成了 https://resgistry.npmjs.org/ &#xff0c;发现还是不行。 问题解决&#xff1a; npm config set strict-ssl false 执行上面命令之后&#xff0c;npm install 成功

如何搭建私有云盘SeaFile并实现远程访问本地文件资料

&#x1f308;个人主页: Aileen_0v0 &#x1f525;热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法 ​&#x1f4ab;个人格言:“没有罗马,那就自己创造罗马~” #mermaid-svg-hsDnDEybLME85dTx {font-family:"trebuchet ms",verdana,arial,sans-serif;font-siz…

有限合伙协议书(模板)上

第一章 合伙的目的和合伙经营范围 第一条 合伙目的&#xff1a;为了适应市场经济的发展&#xff0c;满足市场需求&#xff0c;按照《合伙企业法》规范企业行为&#xff0c;合伙人本着公平、平等、互利的原则&#xff0c;成立 聚源企业管理中心&#xff08;有限合伙&am…

React 面试题

1、组件通信的方式 父组件传子组件&#xff1a;通过props 的方式 子组件传父组件&#xff1a;父组件将自身函数传入&#xff0c;子组件调用该函数&#xff0c;父组件在函数中拿到子组件传递的数据 兄弟组件通信&#xff1a;找到共同的父节点&#xff0c;用父节点转发进行通信 …

三层交换组网实验(思科)

一&#xff0c;技术简介 三层交换技术的出现&#xff0c;解决子网必须依赖路由器进行管理的问题&#xff0c;解决传统路由器低速、复杂所造成的网络瓶颈问题。一个具有三层交换功能的设备可简单理解为&#xff1a;一个带有第三层路由功能的第二层交换机。 二&#xff0c;实验目…

yum命令下载出现Failed to synchronize cache for repo ‘AppStream‘, ignoring this repo.

修改下面的配置文件 问题&#xff1a; cd /etc/yum.repos.d 修改下面四个文件 vim CentOS-Base.repo vim CentOS-AppStream.repo vim CentOS-Extras.repo vim CentOS-PowerTools.repo测试yum是否正常 yum -y install wget

备战蓝桥杯---搜索(DFS基础1)

何为深搜&#xff1f; 即不撞南墙不罢休。 话不多说&#xff0c;直接看题&#xff1a; 我们可以把这看成深搜的模板题&#xff0c;下面是AC代码&#xff1a; #include<bits/stdc.h> using namespace std; int a[15];//存值并输出 int vis[15]; int n18; void dfs(int …

【Git】04 .git目录

文章目录 一、.git目录二、切换分支三、仓库配置信息四、引用五、对象六、总结 一、.git目录 ls -a .git/./ COMMIT_EDITMSG description hooks/ info/ objects/ ../ config HEAD index logs/ refs/二、切换分支 cat .git/HEAD #…