Compare commits
6 Commits
master
...
Springclou
Author | SHA1 | Date | |
---|---|---|---|
82920130c4 | |||
401f58e46f | |||
2ee2961731 | |||
d50c81ecaa | |||
f022d1a9a4 | |||
e9ca234f24 |
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Binary file not shown.
18
.mvn/wrapper/maven-wrapper.properties
vendored
18
.mvn/wrapper/maven-wrapper.properties
vendored
@ -1,18 +0,0 @@
|
|||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
# or more contributor license agreements. See the NOTICE file
|
|
||||||
# distributed with this work for additional information
|
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
|
||||||
# to you under the Apache License, Version 2.0 (the
|
|
||||||
# "License"); you may not use this file except in compliance
|
|
||||||
# with the License. You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing,
|
|
||||||
# software distributed under the License is distributed on an
|
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
# KIND, either express or implied. See the License for the
|
|
||||||
# specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
|
|
||||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
|
|
13
.run/BookApplication-01.run.xml
Normal file
13
.run/BookApplication-01.run.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="BookApplication-01" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="图书服务">
|
||||||
|
<envs>
|
||||||
|
<env name="server.port" value="8201" />
|
||||||
|
<env name="spring.cloud.nacos.discovery.cluster-name" value="Chongqing" />
|
||||||
|
</envs>
|
||||||
|
<module name="book-service" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.BookApplication" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
13
.run/BookApplication-02.run.xml
Normal file
13
.run/BookApplication-02.run.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="BookApplication-02" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="图书服务">
|
||||||
|
<envs>
|
||||||
|
<env name="server.port" value="8202" />
|
||||||
|
<env name="spring.cloud.nacos.discovery.cluster-name" value="Chengdu" />
|
||||||
|
</envs>
|
||||||
|
<module name="book-service" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.BookApplication" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
15
.run/BorrowApplication.run.xml
Normal file
15
.run/BorrowApplication.run.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="BorrowApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||||
|
<module name="borrow-service" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.BorrowApplication" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.test.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
14
.run/ConfigApplication.run.xml
Normal file
14
.run/ConfigApplication.run.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="ConfigApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.ConfigApplication" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.test.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
11
.run/EurekaApplication-01.run.xml
Normal file
11
.run/EurekaApplication-01.run.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="EurekaApplication-01" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="Eureka集群">
|
||||||
|
<envs>
|
||||||
|
<env name="spring.profiles.active" value="01" />
|
||||||
|
</envs>
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.EurekaApplication" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
11
.run/EurekaApplication-02.run.xml
Normal file
11
.run/EurekaApplication-02.run.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="EurekaApplication-02" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="Eureka集群">
|
||||||
|
<envs>
|
||||||
|
<env name="spring.profiles.active" value="02" />
|
||||||
|
</envs>
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.EurekaApplication" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
14
.run/GatewayApplication.run.xml
Normal file
14
.run/GatewayApplication.run.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="GatewayApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.GatewayApplication" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.test.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
8
.run/HystrixDashBoardApplication.run.xml
Normal file
8
.run/HystrixDashBoardApplication.run.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="HystrixDashBoardApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="Hystrix监控服务" nameIsGenerated="true">
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.HystrixDashBoardApplication" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
19
.run/UserApplication-01.run.xml
Normal file
19
.run/UserApplication-01.run.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="UserApplication-01" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="用户服务">
|
||||||
|
<envs>
|
||||||
|
<env name="server.port" value="8101" />
|
||||||
|
<env name="spring.cloud.nacos.discovery.cluster-name" value="Chongqing" />
|
||||||
|
</envs>
|
||||||
|
<module name="user-service" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.UserApplication" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.test.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
13
.run/UserApplication-02.run.xml
Normal file
13
.run/UserApplication-02.run.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="UserApplication-02" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="用户服务">
|
||||||
|
<envs>
|
||||||
|
<env name="server.port" value="8102" />
|
||||||
|
<env name="spring.cloud.nacos.discovery.cluster-name" value="Chengdu" />
|
||||||
|
</envs>
|
||||||
|
<module name="user-service" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.UserApplication" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
15
.run/UserApplication.run.xml
Normal file
15
.run/UserApplication.run.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="UserApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||||
|
<module name="user-service" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.test.UserApplication" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.test.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
@ -20,17 +20,12 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.test;
|
package com.test;
|
||||||
|
|
||||||
|
import com.apple.eawt.Application;
|
||||||
|
import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: BookApplication
|
* ClassName: BookApplication
|
||||||
@ -11,6 +12,7 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
|||||||
* @author yovinchen
|
* @author yovinchen
|
||||||
* @Create 2023/8/14 16:23
|
* @Create 2023/8/14 16:23
|
||||||
*/
|
*/
|
||||||
|
@EnableAutoDataSourceProxy
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class BookApplication {
|
public class BookApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package com.test.controller;
|
package com.test.controller;
|
||||||
|
|
||||||
|
import com.test.entity.Book;
|
||||||
import com.test.service.BookService;
|
import com.test.service.BookService;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import com.test.entity.Book;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: BookController
|
* ClassName: BookController
|
||||||
@ -24,9 +22,19 @@ public class BookController {
|
|||||||
BookService service;
|
BookService service;
|
||||||
|
|
||||||
@RequestMapping("/book/{bid}")
|
@RequestMapping("/book/{bid}")
|
||||||
Book findBookById(@PathVariable("bid") int bid,
|
Book findBookById(@PathVariable("bid") int bid) {
|
||||||
HttpServletRequest request){
|
System.out.println("调用图书服务");
|
||||||
System.out.println(request.getHeader("Test"));
|
|
||||||
return service.getBookById(bid);
|
return service.getBookById(bid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/book/remain/{bid}")
|
||||||
|
public int bookRemain(@PathVariable("bid") int uid){
|
||||||
|
return service.getRemain(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/book/borrow/{bid}")
|
||||||
|
public boolean bookBorrow(@PathVariable("bid") int uid){
|
||||||
|
int remain = service.getRemain(uid);
|
||||||
|
return service.setRemain(uid, remain - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.test.mapper;
|
package com.test.mapper;
|
||||||
|
|
||||||
import com.test.entity.Book;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import com.test.entity.Book;
|
||||||
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: BookMapper
|
* ClassName: BookMapper
|
||||||
@ -17,4 +17,10 @@ public interface BookMapper {
|
|||||||
|
|
||||||
@Select("select * from DB_BOOK where bid = #{bid}")
|
@Select("select * from DB_BOOK where bid = #{bid}")
|
||||||
Book getBookById(int bid);
|
Book getBookById(int bid);
|
||||||
|
|
||||||
|
@Select("select count from DB_BOOK where bid = #{bid}")
|
||||||
|
int getRemain(int bid);
|
||||||
|
|
||||||
|
@Update("update DB_BOOK set count = #{count} where bid = #{bid}")
|
||||||
|
int setRemain(int bid, int count);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
package com.test.service;
|
package com.test.service;
|
||||||
|
|
||||||
import com.test.entity.Book;
|
import com.test.entity.Book;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,4 +11,10 @@ import com.test.entity.Book;
|
|||||||
*/
|
*/
|
||||||
public interface BookService {
|
public interface BookService {
|
||||||
Book getBookById(int bid);
|
Book getBookById(int bid);
|
||||||
|
|
||||||
|
boolean setRemain(int uid, int i);
|
||||||
|
|
||||||
|
int getRemain(int uid);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,14 @@ public class BookServiceImpl implements BookService {
|
|||||||
public Book getBookById(int bid) {
|
public Book getBookById(int bid) {
|
||||||
return mapper.getBookById(bid);
|
return mapper.getBookById(bid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setRemain(int bid, int count) {
|
||||||
|
return mapper.setRemain(bid, count) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRemain(int bid) {
|
||||||
|
return mapper.getRemain(bid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,33 @@
|
|||||||
server:
|
server:
|
||||||
port: 8201
|
port: 8201
|
||||||
spring:
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://43.143.164.194:3306/mac
|
||||||
|
username: mac
|
||||||
|
password: mactest
|
||||||
|
# 应用名称 bookservice
|
||||||
application:
|
application:
|
||||||
name: bookservice
|
name: bookservice
|
||||||
eureka:
|
cloud:
|
||||||
client:
|
nacos:
|
||||||
serviceUrl:
|
discovery:
|
||||||
defaultZone: http://localhost:8801/eureka, http://localhost:8802/eureka
|
# 配置Nacos注册中心地址
|
||||||
instance:
|
server-addr: localhost:8848
|
||||||
prefer-ip-address: true
|
seata:
|
||||||
instance-id: ${spring.cloud.client.ip-address}:${server.port}
|
# 注册
|
||||||
|
registry:
|
||||||
|
# 使用Nacos
|
||||||
|
type: nacos
|
||||||
|
nacos:
|
||||||
|
# 使用Seata的命名空间,这样才能正确找到Seata服务,由于组使用的是SEATA_GROUP,配置默认值就是,就不用配了
|
||||||
|
namespace: c0495138-b5b3-440d-8f1c-dc8cc9ba5fbc
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
# 配置
|
||||||
|
config:
|
||||||
|
type: nacos
|
||||||
|
nacos:
|
||||||
|
namespace: c0495138-b5b3-440d-8f1c-dc8cc9ba5fbc
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
spring:
|
|
||||||
cloud:
|
|
||||||
config:
|
|
||||||
# 名称,其实就是文件名称
|
|
||||||
name: bookservice
|
|
||||||
# 配置服务器的地址
|
|
||||||
uri: http://localhost:8700
|
|
||||||
# 环境
|
|
||||||
profile: prod
|
|
||||||
# 分支
|
|
||||||
label: master
|
|
@ -19,21 +19,21 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
|
|
||||||
<version>2.2.10.RELEASE</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 这里需要单独导入LoadBalancer依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -43,6 +43,11 @@
|
|||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.example</groupId>
|
||||||
|
<artifactId>commons</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.example</groupId>
|
<groupId>org.example</groupId>
|
||||||
<artifactId>commons</artifactId>
|
<artifactId>commons</artifactId>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.test;
|
package com.test;
|
||||||
|
|
||||||
|
import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,9 +12,9 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||||||
* @author yovinchen
|
* @author yovinchen
|
||||||
* @Create 2023/8/14 16:25
|
* @Create 2023/8/14 16:25
|
||||||
*/
|
*/
|
||||||
@EnableHystrix //启用Hystrix
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableFeignClients
|
@EnableFeignClients
|
||||||
|
@EnableAutoDataSourceProxy
|
||||||
|
@SpringBootApplication
|
||||||
public class BorrowApplication {
|
public class BorrowApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(BorrowApplication.class, args);
|
SpringApplication.run(BorrowApplication.class, args);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.test.controller;
|
package com.test.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.test.entity.UserBorrowDetail;
|
import com.test.entity.UserBorrowDetail;
|
||||||
import com.test.service.BorrowService;
|
import com.test.service.BorrowService;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -7,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,4 +29,15 @@ public class BorrowController {
|
|||||||
return service.getUserBorrowDetailByUid(uid);
|
return service.getUserBorrowDetailByUid(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/borrow/take/{uid}/{bid}")
|
||||||
|
JSONObject borrow(@PathVariable("uid") int uid,
|
||||||
|
@PathVariable("bid") int bid){
|
||||||
|
service.doBorrow(uid, bid);
|
||||||
|
|
||||||
|
JSONObject object = new JSONObject();
|
||||||
|
object.put("code", "200");
|
||||||
|
object.put("success", true);
|
||||||
|
object.put("message", "借阅成功!");
|
||||||
|
return object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import lombok.Data;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: entity.com.test.filter.UserBorrowDetail
|
* ClassName: com.test.entity.UserBorrowDetail
|
||||||
* Package: PACKAGE_NAME
|
* Package: PACKAGE_NAME
|
||||||
*
|
*
|
||||||
* @author yovinchen
|
* @author yovinchen
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.test.mapper;
|
package com.test.mapper;
|
||||||
|
|
||||||
import com.test.entity.Borrow;
|
import com.test.entity.Borrow;
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
@ -23,4 +24,7 @@ public interface BorrowMapper {
|
|||||||
|
|
||||||
@Select("select * from DB_BORROW where bid = #{bid} and uid = #{uid}")
|
@Select("select * from DB_BORROW where bid = #{bid} and uid = #{uid}")
|
||||||
Borrow getBorrow(int uid, int bid);
|
Borrow getBorrow(int uid, int bid);
|
||||||
|
|
||||||
|
@Insert("insert into db_borrow(uid, bid) values (#{uid},#{bid})")
|
||||||
|
int addBorrow(int uid, int bid);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.test.service;
|
package com.test.service;
|
||||||
|
|
||||||
|
import com.test.entity.User;
|
||||||
import com.test.entity.UserBorrowDetail;
|
import com.test.entity.UserBorrowDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,4 +13,5 @@ import com.test.entity.UserBorrowDetail;
|
|||||||
public interface BorrowService {
|
public interface BorrowService {
|
||||||
|
|
||||||
UserBorrowDetail getUserBorrowDetailByUid(int uid);
|
UserBorrowDetail getUserBorrowDetailByUid(int uid);
|
||||||
|
boolean doBorrow(int uid, int bid);
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,21 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: VookClient
|
* ClassName: BookClient
|
||||||
* Package: com.test.service.client
|
* Package: com.test.service.client
|
||||||
*
|
*
|
||||||
* @author yovinchen
|
* @author yovinchen
|
||||||
* @Create 2023/8/15 16:56
|
* @Create 2023/8/16 10:55
|
||||||
*/
|
*/
|
||||||
@FeignClient(value = "bookservice", fallback = BookFallbackClient.class)
|
@FeignClient("bookservice")
|
||||||
public interface BookClient {
|
public interface BookClient {
|
||||||
|
|
||||||
@RequestMapping("/book/{bid}")
|
@RequestMapping("/book/{bid}")
|
||||||
Book findBookById(@PathVariable("bid") int bid);
|
Book getBookById(@PathVariable("bid") int bid);
|
||||||
|
|
||||||
|
@RequestMapping("/book/borrow/{bid}")
|
||||||
|
boolean bookBorrow(@PathVariable("bid") int bid);
|
||||||
|
|
||||||
|
@RequestMapping("/book/remain/{bid}")
|
||||||
|
int bookRemain(@PathVariable("bid") int bid);
|
||||||
}
|
}
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package com.test.service.client;
|
|
||||||
|
|
||||||
import com.test.entity.Book;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: BookFallbackClient
|
|
||||||
* Package: com.test.service.client
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/15 20:37
|
|
||||||
*/
|
|
||||||
@Component //注意,需要将其注册为Bean,Feign才能自动注入
|
|
||||||
public class BookFallbackClient implements BookClient {
|
|
||||||
@Override
|
|
||||||
public Book findBookById(int bid) { //这里我们自行对其进行实现,并返回我们的替代方案
|
|
||||||
Book book = new Book();
|
|
||||||
book.setTitle("我是替代方案");
|
|
||||||
return book;
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,13 +10,17 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
* Package: com.test.service.client
|
* Package: com.test.service.client
|
||||||
*
|
*
|
||||||
* @author yovinchen
|
* @author yovinchen
|
||||||
* @Create 2023/8/15 16:54
|
* @Create 2023/8/16 10:55
|
||||||
*/
|
*/
|
||||||
//fallback参数指定为我们刚刚编写的实现类
|
@FeignClient("userservice")
|
||||||
@FeignClient(value = "userservice", fallback = UserFallbackClient.class)
|
|
||||||
public interface UserClient {
|
public interface UserClient {
|
||||||
|
|
||||||
//路径保证和其他微服务提供的一致即可
|
|
||||||
@RequestMapping("/user/{uid}")
|
@RequestMapping("/user/{uid}")
|
||||||
User getUserById(@PathVariable("uid") int uid); //参数和返回值也保持一致
|
User getUserById(@PathVariable("uid") int uid);
|
||||||
|
|
||||||
|
@RequestMapping("/user/borrow/{uid}")
|
||||||
|
boolean userBorrow(@PathVariable("uid") int uid);
|
||||||
|
|
||||||
|
@RequestMapping("/user/remain/{uid}")
|
||||||
|
int userRemain(@PathVariable("uid") int uid);
|
||||||
}
|
}
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package com.test.service.client;
|
|
||||||
|
|
||||||
import com.test.entity.User;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: UserFallbackClient
|
|
||||||
* Package: com.test.service.client
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/15 20:24
|
|
||||||
*/
|
|
||||||
@Component //注意,需要将其注册为Bean,Feign才能自动注入
|
|
||||||
public class UserFallbackClient implements UserClient{
|
|
||||||
@Override
|
|
||||||
public User getUserById(int uid) { //这里我们自行对其进行实现,并返回我们的替代方案
|
|
||||||
User user = new User();
|
|
||||||
user.setName("我是替代方案");
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package com.test.service.impl;
|
package com.test.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.test.entity.Book;
|
import com.test.entity.Book;
|
||||||
import com.test.entity.Borrow;
|
import com.test.entity.Borrow;
|
||||||
import com.test.entity.User;
|
import com.test.entity.User;
|
||||||
@ -9,9 +8,11 @@ import com.test.mapper.BorrowMapper;
|
|||||||
import com.test.service.BorrowService;
|
import com.test.service.BorrowService;
|
||||||
import com.test.service.client.BookClient;
|
import com.test.service.client.BookClient;
|
||||||
import com.test.service.client.UserClient;
|
import com.test.service.client.UserClient;
|
||||||
|
import io.seata.spring.annotation.GlobalTransactional;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -37,12 +38,34 @@ public class BorrowServiceImpl implements BorrowService {
|
|||||||
@Override
|
@Override
|
||||||
public UserBorrowDetail getUserBorrowDetailByUid(int uid) {
|
public UserBorrowDetail getUserBorrowDetailByUid(int uid) {
|
||||||
List<Borrow> borrow = mapper.getBorrowsByUid(uid);
|
List<Borrow> borrow = mapper.getBorrowsByUid(uid);
|
||||||
|
|
||||||
User user = userClient.getUserById(uid);
|
User user = userClient.getUserById(uid);
|
||||||
List<Book> bookList = borrow
|
List<Book> bookList = borrow
|
||||||
.stream()
|
.stream()
|
||||||
.map(b -> bookClient.findBookById(b.getBid()))
|
.map(b -> bookClient.getBookById(b.getBid()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return new UserBorrowDetail(user, bookList);
|
return new UserBorrowDetail(user, bookList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GlobalTransactional
|
||||||
|
public boolean doBorrow(int uid, int bid) {
|
||||||
|
//1. 判断图书和用户是否都支持借阅
|
||||||
|
if(bookClient.bookRemain(bid) < 1)
|
||||||
|
throw new RuntimeException("图书数量不足");
|
||||||
|
if(userClient.userRemain(uid) < 1)
|
||||||
|
throw new RuntimeException("用户借阅量不足");
|
||||||
|
//2. 首先将图书的数量-1
|
||||||
|
if(!bookClient.bookBorrow(bid))
|
||||||
|
throw new RuntimeException("在借阅图书时出现错误!");
|
||||||
|
//3. 添加借阅信息
|
||||||
|
if(mapper.getBorrow(uid, bid) != null)
|
||||||
|
throw new RuntimeException("此书籍已经被此用户借阅了!");
|
||||||
|
if(mapper.addBorrow(uid, bid) <= 0)
|
||||||
|
throw new RuntimeException("在录入借阅信息时出现错误!");
|
||||||
|
//4. 用户可借阅-1
|
||||||
|
if(!userClient.userBorrow(uid))
|
||||||
|
throw new RuntimeException("在借阅时出现错误!");
|
||||||
|
//完成
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,39 @@
|
|||||||
server:
|
server:
|
||||||
port: 8301
|
port: 8301
|
||||||
spring:
|
spring:
|
||||||
application:
|
|
||||||
name: borrowservice
|
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://43.143.164.194:3306/mac
|
url: jdbc:mysql://43.143.164.194:3306/mac
|
||||||
username: mac
|
username: mac
|
||||||
password: mactest
|
password: mactest
|
||||||
eureka:
|
# 应用名称 borrowservice
|
||||||
client:
|
application:
|
||||||
serviceUrl:
|
name: borrowservice
|
||||||
defaultZone: http://localhost:8801/eureka, http://localhost:8802/eureka
|
cloud:
|
||||||
instance:
|
nacos:
|
||||||
prefer-ip-address: true
|
discovery:
|
||||||
instance-id: ${spring.cloud.client.ip-address}:${server.port}
|
# 配置Nacos注册中心地址
|
||||||
feign:
|
server-addr: localhost:8848
|
||||||
circuitbreaker:
|
# 将ephemeral修改为false,表示非临时实例(用于持续监控)
|
||||||
|
ephemeral: false
|
||||||
|
cluster-name: Chengdu
|
||||||
|
loadbalancer:
|
||||||
|
nacos:
|
||||||
enabled: true
|
enabled: true
|
||||||
management:
|
seata:
|
||||||
endpoints:
|
# 注册
|
||||||
web:
|
registry:
|
||||||
exposure:
|
# 使用Nacos
|
||||||
include: '*'
|
type: nacos
|
||||||
|
nacos:
|
||||||
|
# 使用Seata的命名空间,这样才能正确找到Seata服务,由于组使用的是SEATA_GROUP,配置默认值就是,就不用配了
|
||||||
|
namespace: c0495138-b5b3-440d-8f1c-dc8cc9ba5fbc
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
# 配置
|
||||||
|
config:
|
||||||
|
type: nacos
|
||||||
|
nacos:
|
||||||
|
namespace: c0495138-b5b3-440d-8f1c-dc8cc9ba5fbc
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
@ -14,4 +14,5 @@ public class Book {
|
|||||||
int bid;
|
int bid;
|
||||||
String title;
|
String title;
|
||||||
String des;
|
String des;
|
||||||
|
int count;
|
||||||
}
|
}
|
||||||
|
@ -14,18 +14,13 @@ public class User {
|
|||||||
int uid;
|
int uid;
|
||||||
String name;
|
String name;
|
||||||
String sex;
|
String sex;
|
||||||
|
int book_count;
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: Book
|
|
||||||
* Package: com.test.entity
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/14 17:01
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
public static class Book {
|
public static class Book {
|
||||||
int bid;
|
int bid;
|
||||||
String title;
|
String title;
|
||||||
String desc;
|
String desc;
|
||||||
|
int book_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.example</groupId>
|
|
||||||
<artifactId>SpringCloudStudy</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>org.example</groupId>
|
|
||||||
<artifactId>config-service</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-config-server</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.test;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.config.server.EnableConfigServer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: ConfigApplication
|
|
||||||
* Package: com.test
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/16 09:06
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableConfigServer
|
|
||||||
public class ConfigApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(ConfigApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8700
|
|
||||||
spring:
|
|
||||||
cloud:
|
|
||||||
config:
|
|
||||||
server:
|
|
||||||
git:
|
|
||||||
# 这里填写的是本地仓库地址,远程仓库直接填写远程仓库地址 http://git...
|
|
||||||
uri: file://${user.home}/project/Java/demo/config-repo
|
|
||||||
# 默认分支设定为你自己本地或是远程分支的名称
|
|
||||||
default-label: master
|
|
||||||
application:
|
|
||||||
name: configservice
|
|
||||||
eureka:
|
|
||||||
client:
|
|
||||||
service-url:
|
|
||||||
defaultZone: http://localhost:8801/eureka, http://localhost:8802/eureka
|
|
@ -1,30 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.example</groupId>
|
|
||||||
<artifactId>SpringCloudStudy</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>org.example</groupId>
|
|
||||||
<artifactId>eureka-service</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.test;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: com.test.EurekaApplication
|
|
||||||
* Package: PACKAGE_NAME
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/15 09:52
|
|
||||||
*/
|
|
||||||
@EnableEurekaServer
|
|
||||||
@SpringBootApplication
|
|
||||||
public class EurekaApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(EurekaApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8801
|
|
||||||
spring:
|
|
||||||
application:
|
|
||||||
name: eurekaserver
|
|
||||||
eureka:
|
|
||||||
instance:
|
|
||||||
hostname: eureka01
|
|
||||||
prefer-ip-address: false
|
|
||||||
instance-id: ${spring.cloud.client.ip-address}:${server.port}
|
|
||||||
client:
|
|
||||||
fetch-registry: false
|
|
||||||
serviceUrl:
|
|
||||||
defaultZone: http://eureka02:8802/eureka, http://eureka01:8801/eureka
|
|
||||||
server:
|
|
||||||
enable-self-preservation: false
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8802
|
|
||||||
spring:
|
|
||||||
application:
|
|
||||||
name: eurekaserver
|
|
||||||
eureka:
|
|
||||||
instance:
|
|
||||||
hostname: eureka02
|
|
||||||
prefer-ip-address: false
|
|
||||||
instance-id: ${spring.cloud.client.ip-address}:${server.port}
|
|
||||||
client:
|
|
||||||
fetch-registry: false
|
|
||||||
serviceUrl:
|
|
||||||
defaultZone: http://eureka01:8801/eureka, http://eureka02:8802/eureka
|
|
||||||
server:
|
|
||||||
enable-self-preservation: false
|
|
@ -1,30 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.example</groupId>
|
|
||||||
<artifactId>SpringCloudStudy</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>org.example</groupId>
|
|
||||||
<artifactId>gateway-service</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.test;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: GatewayApplication
|
|
||||||
* Package: com.test
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/16 08:52
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
public class GatewayApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(GatewayApplication.class,args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.test.filter;
|
|
||||||
|
|
||||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
|
||||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
|
||||||
import org.springframework.core.Ordered;
|
|
||||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: filterTestFilter
|
|
||||||
* Package: com.test
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/16 08:51
|
|
||||||
*/
|
|
||||||
@Component //需要注册为Bean
|
|
||||||
public class TestFilter implements GlobalFilter , Ordered {
|
|
||||||
@Override
|
|
||||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
|
||||||
//先获取ServerHttpRequest对象,注意不是HttpServletRequest
|
|
||||||
ServerHttpRequest request = exchange.getRequest();
|
|
||||||
//打印一下所有的请求参数
|
|
||||||
System.out.println(request.getQueryParams());
|
|
||||||
//判断是否包含test参数,且参数值为1
|
|
||||||
List<String> value = request.getQueryParams().get("test");
|
|
||||||
if(value != null && value.contains("1")) {
|
|
||||||
//将ServerWebExchange向过滤链的下一级传递(跟JavaWeb中介绍的过滤器其实是差不多的)
|
|
||||||
return chain.filter(exchange);
|
|
||||||
}else {
|
|
||||||
//直接在这里不再向下传递,然后返回响应
|
|
||||||
return exchange.getResponse().setComplete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//设置过滤等级(越小优先级越高)
|
|
||||||
@Override
|
|
||||||
public int getOrder() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8500
|
|
||||||
eureka:
|
|
||||||
instance:
|
|
||||||
prefer-ip-address: true
|
|
||||||
instance-id: ${spring.cloud.client.ip-address}:${server.port}
|
|
||||||
client:
|
|
||||||
service-url:
|
|
||||||
defaultZone: http://localhost:8801/eureka, http://localhost:8802/eureka
|
|
||||||
spring:
|
|
||||||
application:
|
|
||||||
name: gateway
|
|
||||||
cloud:
|
|
||||||
gateway:
|
|
||||||
routes:
|
|
||||||
- id: borrow-service
|
|
||||||
uri: lb://borrowservice
|
|
||||||
predicates:
|
|
||||||
- Path=/borrow/**
|
|
||||||
# 继续添加新的路由配置,这里就以书籍管理服务为例
|
|
||||||
# 注意-要对齐routes:
|
|
||||||
- id: book-service
|
|
||||||
uri: lb://bookservice
|
|
||||||
predicates:
|
|
||||||
- Path=/book/**
|
|
||||||
filters: # 添加过滤器
|
|
||||||
- AddRequestHeader=Test, HelloWorld!
|
|
||||||
# AddRequestHeader 就是添加请求头信息,其他工厂请查阅官网
|
|
@ -1,29 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.example</groupId>
|
|
||||||
<artifactId>SpringCloudStudy</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>org.example</groupId>
|
|
||||||
<artifactId>hystrix-dashboard</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
|
|
||||||
<version>2.2.10.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.test;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassName: HystrixApplication
|
|
||||||
* Package: com.test
|
|
||||||
*
|
|
||||||
* @author yovinchen
|
|
||||||
* @Create 2023/8/15 21:19
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableHystrixDashboard
|
|
||||||
public class HystrixDashBoardApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(HystrixDashBoardApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8900
|
|
||||||
hystrix:
|
|
||||||
dashboard:
|
|
||||||
# 将localhost添加到白名单,默认是不允许的
|
|
||||||
proxy-stream-allow-list: "localhost"
|
|
316
mvnw
vendored
316
mvnw
vendored
@ -1,316 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
# or more contributor license agreements. See the NOTICE file
|
|
||||||
# distributed with this work for additional information
|
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
|
||||||
# to you under the Apache License, Version 2.0 (the
|
|
||||||
# "License"); you may not use this file except in compliance
|
|
||||||
# with the License. You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing,
|
|
||||||
# software distributed under the License is distributed on an
|
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
# KIND, either express or implied. See the License for the
|
|
||||||
# specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Maven Start Up Batch script
|
|
||||||
#
|
|
||||||
# Required ENV vars:
|
|
||||||
# ------------------
|
|
||||||
# JAVA_HOME - location of a JDK home dir
|
|
||||||
#
|
|
||||||
# Optional ENV vars
|
|
||||||
# -----------------
|
|
||||||
# M2_HOME - location of maven2's installed home dir
|
|
||||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
# e.g. to debug Maven itself, use
|
|
||||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
|
||||||
|
|
||||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
|
||||||
. /usr/local/etc/mavenrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /etc/mavenrc ] ; then
|
|
||||||
. /etc/mavenrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$HOME/.mavenrc" ] ; then
|
|
||||||
. "$HOME/.mavenrc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# OS specific support. $var _must_ be set to either true or false.
|
|
||||||
cygwin=false;
|
|
||||||
darwin=false;
|
|
||||||
mingw=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN*) cygwin=true ;;
|
|
||||||
MINGW*) mingw=true;;
|
|
||||||
Darwin*) darwin=true
|
|
||||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
|
||||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
|
||||||
if [ -x "/usr/libexec/java_home" ]; then
|
|
||||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
|
||||||
else
|
|
||||||
export JAVA_HOME="/Library/Java/Home"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
if [ -r /etc/gentoo-release ] ; then
|
|
||||||
JAVA_HOME=`java-config --jre-home`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$M2_HOME" ] ; then
|
|
||||||
## resolve links - $0 may be a link to maven's home
|
|
||||||
PRG="$0"
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG="`dirname "$PRG"`/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
saveddir=`pwd`
|
|
||||||
|
|
||||||
M2_HOME=`dirname "$PRG"`/..
|
|
||||||
|
|
||||||
# make it fully qualified
|
|
||||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
|
||||||
|
|
||||||
cd "$saveddir"
|
|
||||||
# echo Using m2 at $M2_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $mingw ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
|
||||||
javaExecutable="`which javac`"
|
|
||||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
|
||||||
# readlink(1) is not available as standard on Solaris 10.
|
|
||||||
readLink=`which readlink`
|
|
||||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
|
||||||
if $darwin ; then
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
|
||||||
else
|
|
||||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
|
||||||
fi
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
|
||||||
JAVA_HOME="$javaHome"
|
|
||||||
export JAVA_HOME
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVACMD" ] ; then
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="`\\unset -f command; \\command -v java`"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
|
||||||
echo " We cannot execute $JAVACMD" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
echo "Warning: JAVA_HOME environment variable is not set."
|
|
||||||
fi
|
|
||||||
|
|
||||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
|
||||||
|
|
||||||
# traverses directory structure from process work directory to filesystem root
|
|
||||||
# first directory with .mvn subdirectory is considered project base directory
|
|
||||||
find_maven_basedir() {
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
echo "Path not specified to find_maven_basedir"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
basedir="$1"
|
|
||||||
wdir="$1"
|
|
||||||
while [ "$wdir" != '/' ] ; do
|
|
||||||
if [ -d "$wdir"/.mvn ] ; then
|
|
||||||
basedir=$wdir
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
|
||||||
if [ -d "${wdir}" ]; then
|
|
||||||
wdir=`cd "$wdir/.."; pwd`
|
|
||||||
fi
|
|
||||||
# end of workaround
|
|
||||||
done
|
|
||||||
echo "${basedir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# concatenates all lines of a file
|
|
||||||
concat_lines() {
|
|
||||||
if [ -f "$1" ]; then
|
|
||||||
echo "$(tr -s '\n' ' ' < "$1")"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
|
||||||
if [ -z "$BASE_DIR" ]; then
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
|
||||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
|
||||||
##########################################################################################
|
|
||||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
|
||||||
fi
|
|
||||||
if [ -n "$MVNW_REPOURL" ]; then
|
|
||||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
||||||
else
|
|
||||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
||||||
fi
|
|
||||||
while IFS="=" read key value; do
|
|
||||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
|
||||||
esac
|
|
||||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Downloading from: $jarUrl"
|
|
||||||
fi
|
|
||||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
|
||||||
if $cygwin; then
|
|
||||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
if command -v wget > /dev/null; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found wget ... using wget"
|
|
||||||
fi
|
|
||||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
||||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
|
||||||
else
|
|
||||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
|
||||||
fi
|
|
||||||
elif command -v curl > /dev/null; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found curl ... using curl"
|
|
||||||
fi
|
|
||||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
||||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
|
||||||
else
|
|
||||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Falling back to using Java to download"
|
|
||||||
fi
|
|
||||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
|
||||||
# For Cygwin, switch paths to Windows format before running javac
|
|
||||||
if $cygwin; then
|
|
||||||
javaClass=`cygpath --path --windows "$javaClass"`
|
|
||||||
fi
|
|
||||||
if [ -e "$javaClass" ]; then
|
|
||||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
|
||||||
fi
|
|
||||||
# Compiling the Java class
|
|
||||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
|
||||||
fi
|
|
||||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
||||||
# Running the downloader
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo " - Running MavenWrapperDownloader.java ..."
|
|
||||||
fi
|
|
||||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
##########################################################################################
|
|
||||||
# End of extension
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo $MAVEN_PROJECTBASEDIR
|
|
||||||
fi
|
|
||||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
|
||||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
|
||||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Provide a "standardized" way to retrieve the CLI args that will
|
|
||||||
# work with both Windows and non-Windows executions.
|
|
||||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
|
||||||
export MAVEN_CMD_LINE_ARGS
|
|
||||||
|
|
||||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
exec "$JAVACMD" \
|
|
||||||
$MAVEN_OPTS \
|
|
||||||
$MAVEN_DEBUG_OPTS \
|
|
||||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
|
||||||
"-Dmaven.home=${M2_HOME}" \
|
|
||||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
|
||||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
|
188
mvnw.cmd
vendored
188
mvnw.cmd
vendored
@ -1,188 +0,0 @@
|
|||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
@REM or more contributor license agreements. See the NOTICE file
|
|
||||||
@REM distributed with this work for additional information
|
|
||||||
@REM regarding copyright ownership. The ASF licenses this file
|
|
||||||
@REM to you under the Apache License, Version 2.0 (the
|
|
||||||
@REM "License"); you may not use this file except in compliance
|
|
||||||
@REM with the License. You may obtain a copy of the License at
|
|
||||||
@REM
|
|
||||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@REM
|
|
||||||
@REM Unless required by applicable law or agreed to in writing,
|
|
||||||
@REM software distributed under the License is distributed on an
|
|
||||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
@REM KIND, either express or implied. See the License for the
|
|
||||||
@REM specific language governing permissions and limitations
|
|
||||||
@REM under the License.
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
@REM Maven Start Up Batch script
|
|
||||||
@REM
|
|
||||||
@REM Required ENV vars:
|
|
||||||
@REM JAVA_HOME - location of a JDK home dir
|
|
||||||
@REM
|
|
||||||
@REM Optional ENV vars
|
|
||||||
@REM M2_HOME - location of maven2's installed home dir
|
|
||||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
|
||||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
|
||||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
@REM e.g. to debug Maven itself, use
|
|
||||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
|
||||||
@echo off
|
|
||||||
@REM set title of command window
|
|
||||||
title %0
|
|
||||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
|
||||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
|
||||||
|
|
||||||
@REM set %HOME% to equivalent of $HOME
|
|
||||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
|
||||||
|
|
||||||
@REM Execute a user defined script before this one
|
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
|
||||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
|
||||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
|
||||||
:skipRcPre
|
|
||||||
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
set ERROR_CODE=0
|
|
||||||
|
|
||||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
@REM ==== START VALIDATION ====
|
|
||||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME not found in your environment. >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
:OkJHome
|
|
||||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
|
||||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
@REM ==== END VALIDATION ====
|
|
||||||
|
|
||||||
:init
|
|
||||||
|
|
||||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
|
||||||
@REM Fallback to current working directory if not found.
|
|
||||||
|
|
||||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
|
||||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
|
||||||
|
|
||||||
set EXEC_DIR=%CD%
|
|
||||||
set WDIR=%EXEC_DIR%
|
|
||||||
:findBaseDir
|
|
||||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
|
||||||
cd ..
|
|
||||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
|
||||||
set WDIR=%CD%
|
|
||||||
goto findBaseDir
|
|
||||||
|
|
||||||
:baseDirFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
goto endDetectBaseDir
|
|
||||||
|
|
||||||
:baseDirNotFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
|
|
||||||
:endDetectBaseDir
|
|
||||||
|
|
||||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
|
||||||
|
|
||||||
@setlocal EnableExtensions EnableDelayedExpansion
|
|
||||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
|
||||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
|
||||||
|
|
||||||
:endReadAdditionalConfig
|
|
||||||
|
|
||||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
|
||||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
|
||||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
||||||
|
|
||||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
|
||||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
|
||||||
)
|
|
||||||
|
|
||||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
|
||||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
|
||||||
if exist %WRAPPER_JAR% (
|
|
||||||
if "%MVNW_VERBOSE%" == "true" (
|
|
||||||
echo Found %WRAPPER_JAR%
|
|
||||||
)
|
|
||||||
) else (
|
|
||||||
if not "%MVNW_REPOURL%" == "" (
|
|
||||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
||||||
)
|
|
||||||
if "%MVNW_VERBOSE%" == "true" (
|
|
||||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
|
||||||
echo Downloading from: %DOWNLOAD_URL%
|
|
||||||
)
|
|
||||||
|
|
||||||
powershell -Command "&{"^
|
|
||||||
"$webclient = new-object System.Net.WebClient;"^
|
|
||||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
|
||||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
|
||||||
"}"^
|
|
||||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
|
||||||
"}"
|
|
||||||
if "%MVNW_VERBOSE%" == "true" (
|
|
||||||
echo Finished downloading %WRAPPER_JAR%
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@REM End of extension
|
|
||||||
|
|
||||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
|
||||||
@REM work with both Windows and non-Windows executions.
|
|
||||||
set MAVEN_CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
%MAVEN_JAVA_EXE% ^
|
|
||||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
|
||||||
%MAVEN_OPTS% ^
|
|
||||||
%MAVEN_DEBUG_OPTS% ^
|
|
||||||
-classpath %WRAPPER_JAR% ^
|
|
||||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
|
||||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
|
||||||
if ERRORLEVEL 1 goto error
|
|
||||||
goto end
|
|
||||||
|
|
||||||
:error
|
|
||||||
set ERROR_CODE=1
|
|
||||||
|
|
||||||
:end
|
|
||||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
|
||||||
|
|
||||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
|
||||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
|
||||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
|
||||||
:skipRcPost
|
|
||||||
|
|
||||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
|
||||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
|
||||||
|
|
||||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
|
||||||
|
|
||||||
cmd /C exit /B %ERROR_CODE%
|
|
316
nacos/LICENSE
Normal file
316
nacos/LICENSE
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (properties) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
------
|
||||||
|
This product has a bundle logback, which is available under the EPL v1.0 License.
|
||||||
|
The source code of logback can be found at https://github.com/qos-ch/logback.
|
||||||
|
|
||||||
|
Logback LICENSE
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Logback: the reliable, generic, fast and flexible logging framework.
|
||||||
|
Copyright (C) 1999-2015, QOS.ch. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are dual-licensed under
|
||||||
|
either the terms of the Eclipse Public License v1.0 as published by
|
||||||
|
the Eclipse Foundation
|
||||||
|
|
||||||
|
or (per the licensee's choosing)
|
||||||
|
|
||||||
|
under the terms of the GNU Lesser General Public License version 2.1
|
||||||
|
as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
------
|
||||||
|
This product has a bundle slf4j, which is available under the MIT License.
|
||||||
|
The source code of slf4j can be found at https://github.com/qos-ch/slf4j.
|
||||||
|
|
||||||
|
Copyright (c) 2004-2017 QOS.ch
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
------
|
||||||
|
This product has a bundle javassist, which is available under the ASL2 License.
|
||||||
|
The source code of javassist can be found at https://github.com/jboss-javassist/javassist.
|
||||||
|
|
||||||
|
Copyright (C) 1999- by Shigeru Chiba, All rights reserved.
|
||||||
|
|
||||||
|
Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation simple.
|
||||||
|
It is a class library for editing bytecodes in Java; it enables Java programs to define a new class
|
||||||
|
at runtime and to modify a class file when the JVM loads it. Unlike other similar bytecode editors,
|
||||||
|
Javassist provides two levels of API: source level and bytecode level. If the users use the source- level API,
|
||||||
|
they can edit a class file without knowledge of the specifications of the Java bytecode.
|
||||||
|
The whole API is designed with only the vocabulary of the Java language.
|
||||||
|
You can even specify inserted bytecode in the form of source text; Javassist compiles it on the fly.
|
||||||
|
On the other hand, the bytecode-level API allows the users to directly edit a class file as other editors.
|
||||||
|
|
||||||
|
This software is distributed under the Mozilla Public License Version 1.1,
|
||||||
|
the GNU Lesser General Public License Version 2.1 or later, or the Apache License Version 2.0.
|
||||||
|
|
||||||
|
------
|
||||||
|
This product has a bundle jna, which is available under the ASL2 License.
|
||||||
|
The source code of jna can be found at https://github.com/java-native-access/jna.
|
||||||
|
|
||||||
|
This copy of JNA is licensed under the
|
||||||
|
Apache (Software) License, version 2.0 ("the License").
|
||||||
|
See the License for details about distribution rights, and the
|
||||||
|
specific rights regarding derivate works.
|
||||||
|
|
||||||
|
You may obtain a copy of the License at:
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
A copy is also included in the downloadable source code package
|
||||||
|
containing JNA, in file "AL2.0", under the same directory
|
||||||
|
as this file.
|
||||||
|
------
|
||||||
|
This product has a bundle guava, which is available under the ASL2 License.
|
||||||
|
The source code of guava can be found at https://github.com/google/guava.
|
||||||
|
|
||||||
|
Copyright (C) 2007 The Guava authors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
------
|
||||||
|
This product has a bundle OpenMessaging, which is available under the ASL2 License.
|
||||||
|
The source code of OpenMessaging can be found at https://github.com/openmessaging/openmessaging.
|
||||||
|
|
||||||
|
Copyright (C) 2017 The OpenMessaging authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
36
nacos/NOTICE
Normal file
36
nacos/NOTICE
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Nacos
|
||||||
|
Copyright 2018-2019 The Apache Software Foundation
|
||||||
|
|
||||||
|
This product includes software developed at
|
||||||
|
The Alibaba MiddleWare Group.
|
||||||
|
|
||||||
|
------
|
||||||
|
This product has a bundle netty:
|
||||||
|
The Spring oot Project
|
||||||
|
=================
|
||||||
|
|
||||||
|
Please visit the Netty web site for more information:
|
||||||
|
|
||||||
|
* http://netty.io/
|
||||||
|
|
||||||
|
Copyright 2014 The Netty Project
|
||||||
|
|
||||||
|
The Netty Project licenses this file to you under the Apache License,
|
||||||
|
version 2.0 (the "License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at:
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
|
||||||
|
Also, please refer to each LICENSE.<component>.txt file, which is located in
|
||||||
|
the 'license' directory of the distribution file, for the license terms of the
|
||||||
|
components that this product depends on.
|
||||||
|
|
||||||
|
------
|
||||||
|
This product has a bundle commons-lang, which includes software from the Spring Framework,
|
||||||
|
under the Apache License 2.0 (see: StringUtils.containsWhitespace())
|
0
nacos/bin/logs/access_log.2023-08-16.log
Normal file
0
nacos/bin/logs/access_log.2023-08-16.log
Normal file
24
nacos/bin/shutdown.cmd
Executable file
24
nacos/bin/shutdown.cmd
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
@echo off
|
||||||
|
rem Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
rem you may not use this file except in compliance with the License.
|
||||||
|
rem You may obtain a copy of the License at
|
||||||
|
rem
|
||||||
|
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
rem
|
||||||
|
rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
rem See the License for the specific language governing permissions and
|
||||||
|
rem limitations under the License.
|
||||||
|
if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
|
||||||
|
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set "PATH=%JAVA_HOME%\bin;%PATH%"
|
||||||
|
|
||||||
|
echo killing nacos server
|
||||||
|
|
||||||
|
for /f "tokens=1" %%i in ('jps -m ^| find "nacos.nacos"') do ( taskkill /F /PID %%i )
|
||||||
|
|
||||||
|
echo Done!
|
28
nacos/bin/shutdown.sh
Executable file
28
nacos/bin/shutdown.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
cd `dirname $0`/../target
|
||||||
|
target_dir=`pwd`
|
||||||
|
|
||||||
|
pid=`ps ax | grep -i 'nacos.nacos' | grep ${target_dir} | grep java | grep -v grep | awk '{print $1}'`
|
||||||
|
if [ -z "$pid" ] ; then
|
||||||
|
echo "No nacosServer running."
|
||||||
|
exit -1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "The nacosServer(${pid}) is running..."
|
||||||
|
|
||||||
|
kill ${pid}
|
||||||
|
|
||||||
|
echo "Send shutdown request to nacosServer(${pid}) OK"
|
95
nacos/bin/startup.cmd
Executable file
95
nacos/bin/startup.cmd
Executable file
@ -0,0 +1,95 @@
|
|||||||
|
@echo off
|
||||||
|
rem Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
rem you may not use this file except in compliance with the License.
|
||||||
|
rem You may obtain a copy of the License at
|
||||||
|
rem
|
||||||
|
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
rem
|
||||||
|
rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
rem See the License for the specific language governing permissions and
|
||||||
|
rem limitations under the License.
|
||||||
|
if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
|
||||||
|
set "JAVA=%JAVA_HOME%\bin\java.exe"
|
||||||
|
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
set BASE_DIR=%~dp0
|
||||||
|
rem added double quotation marks to avoid the issue caused by the folder names containing spaces.
|
||||||
|
rem removed the last 5 chars(which means \bin\) to get the base DIR.
|
||||||
|
set BASE_DIR="%BASE_DIR:~0,-5%"
|
||||||
|
|
||||||
|
set CUSTOM_SEARCH_LOCATIONS=file:%BASE_DIR%/conf/
|
||||||
|
|
||||||
|
set MODE="cluster"
|
||||||
|
set FUNCTION_MODE="all"
|
||||||
|
set SERVER=nacos-server
|
||||||
|
set MODE_INDEX=-1
|
||||||
|
set FUNCTION_MODE_INDEX=-1
|
||||||
|
set SERVER_INDEX=-1
|
||||||
|
set EMBEDDED_STORAGE_INDEX=-1
|
||||||
|
set EMBEDDED_STORAGE=""
|
||||||
|
|
||||||
|
|
||||||
|
set i=0
|
||||||
|
for %%a in (%*) do (
|
||||||
|
if "%%a" == "-m" ( set /a MODE_INDEX=!i!+1 )
|
||||||
|
if "%%a" == "-f" ( set /a FUNCTION_MODE_INDEX=!i!+1 )
|
||||||
|
if "%%a" == "-s" ( set /a SERVER_INDEX=!i!+1 )
|
||||||
|
if "%%a" == "-p" ( set /a EMBEDDED_STORAGE_INDEX=!i!+1 )
|
||||||
|
set /a i+=1
|
||||||
|
)
|
||||||
|
|
||||||
|
set i=0
|
||||||
|
for %%a in (%*) do (
|
||||||
|
if %MODE_INDEX% == !i! ( set MODE="%%a" )
|
||||||
|
if %FUNCTION_MODE_INDEX% == !i! ( set FUNCTION_MODE="%%a" )
|
||||||
|
if %SERVER_INDEX% == !i! (set SERVER="%%a")
|
||||||
|
if %EMBEDDED_STORAGE_INDEX% == !i! (set EMBEDDED_STORAGE="%%a")
|
||||||
|
set /a i+=1
|
||||||
|
)
|
||||||
|
|
||||||
|
rem if nacos startup mode is standalone
|
||||||
|
if %MODE% == "standalone" (
|
||||||
|
echo "nacos is starting with standalone"
|
||||||
|
set "NACOS_OPTS=-Dnacos.standalone=true"
|
||||||
|
set "NACOS_JVM_OPTS=-Xms512m -Xmx512m -Xmn256m"
|
||||||
|
)
|
||||||
|
|
||||||
|
rem if nacos startup mode is cluster
|
||||||
|
if %MODE% == "cluster" (
|
||||||
|
echo "nacos is starting with cluster"
|
||||||
|
if %EMBEDDED_STORAGE% == "embedded" (
|
||||||
|
set "NACOS_OPTS=-DembeddedStorage=true"
|
||||||
|
)
|
||||||
|
|
||||||
|
set "NACOS_JVM_OPTS=-server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof -XX:-UseLargePages"
|
||||||
|
)
|
||||||
|
|
||||||
|
rem set nacos's functionMode
|
||||||
|
if %FUNCTION_MODE% == "config" (
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=config"
|
||||||
|
)
|
||||||
|
|
||||||
|
if %FUNCTION_MODE% == "naming" (
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=naming"
|
||||||
|
)
|
||||||
|
|
||||||
|
rem set nacos options
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -Dloader.path=%BASE_DIR%/plugins/health,%BASE_DIR%/plugins/cmdb"
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.home=%BASE_DIR%"
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -jar %BASE_DIR%\target\%SERVER%.jar"
|
||||||
|
|
||||||
|
rem set nacos spring config location
|
||||||
|
set "NACOS_CONFIG_OPTS=--spring.config.additional-location=optional:%CUSTOM_SEARCH_LOCATIONS%"
|
||||||
|
|
||||||
|
rem set nacos log4j file location
|
||||||
|
set "NACOS_LOG4J_OPTS=--logging.config=%BASE_DIR%/conf/nacos-logback.xml"
|
||||||
|
|
||||||
|
|
||||||
|
set COMMAND="%JAVA%" %NACOS_JVM_OPTS% %NACOS_OPTS% %NACOS_CONFIG_OPTS% %NACOS_LOG4J_OPTS% nacos.nacos %*
|
||||||
|
|
||||||
|
rem start nacos command
|
||||||
|
%COMMAND%
|
141
nacos/bin/startup.sh
Executable file
141
nacos/bin/startup.sh
Executable file
@ -0,0 +1,141 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
cygwin=false
|
||||||
|
darwin=false
|
||||||
|
os400=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN*) cygwin=true;;
|
||||||
|
Darwin*) darwin=true;;
|
||||||
|
OS400*) os400=true;;
|
||||||
|
esac
|
||||||
|
error_exit ()
|
||||||
|
{
|
||||||
|
echo "ERROR: $1 !!"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
|
||||||
|
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
|
||||||
|
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/taobao/java
|
||||||
|
[ ! -e "$JAVA_HOME/bin/java" ] && unset JAVA_HOME
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if $darwin; then
|
||||||
|
|
||||||
|
if [ -x '/usr/libexec/java_home' ] ; then
|
||||||
|
export JAVA_HOME=`/usr/libexec/java_home`
|
||||||
|
|
||||||
|
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
|
||||||
|
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVA_PATH=`dirname $(readlink -f $(which javac))`
|
||||||
|
if [ "x$JAVA_PATH" != "x" ]; then
|
||||||
|
export JAVA_HOME=`dirname $JAVA_PATH 2>/dev/null`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SERVER="nacos-server"
|
||||||
|
export MODE="cluster"
|
||||||
|
export FUNCTION_MODE="all"
|
||||||
|
export MEMBER_LIST=""
|
||||||
|
export EMBEDDED_STORAGE=""
|
||||||
|
while getopts ":m:f:s:c:p:" opt
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
|
m)
|
||||||
|
MODE=$OPTARG;;
|
||||||
|
f)
|
||||||
|
FUNCTION_MODE=$OPTARG;;
|
||||||
|
s)
|
||||||
|
SERVER=$OPTARG;;
|
||||||
|
c)
|
||||||
|
MEMBER_LIST=$OPTARG;;
|
||||||
|
p)
|
||||||
|
EMBEDDED_STORAGE=$OPTARG;;
|
||||||
|
?)
|
||||||
|
echo "Unknown parameter"
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
export JAVA_HOME
|
||||||
|
export JAVA="$JAVA_HOME/bin/java"
|
||||||
|
export BASE_DIR=`cd $(dirname $0)/..; pwd`
|
||||||
|
export CUSTOM_SEARCH_LOCATIONS=file:${BASE_DIR}/conf/
|
||||||
|
|
||||||
|
#===========================================================================================
|
||||||
|
# JVM Configuration
|
||||||
|
#===========================================================================================
|
||||||
|
if [[ "${MODE}" == "standalone" ]]; then
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Xms512m -Xmx512m -Xmn256m"
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Dnacos.standalone=true"
|
||||||
|
else
|
||||||
|
if [[ "${EMBEDDED_STORAGE}" == "embedded" ]]; then
|
||||||
|
JAVA_OPT="${JAVA_OPT} -DembeddedStorage=true"
|
||||||
|
fi
|
||||||
|
JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
|
||||||
|
JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASE_DIR}/logs/java_heapdump.hprof"
|
||||||
|
JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${FUNCTION_MODE}" == "config" ]]; then
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=config"
|
||||||
|
elif [[ "${FUNCTION_MODE}" == "naming" ]]; then
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=naming"
|
||||||
|
fi
|
||||||
|
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Dnacos.member.list=${MEMBER_LIST}"
|
||||||
|
|
||||||
|
JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p')
|
||||||
|
if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400"
|
||||||
|
else
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext"
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
|
||||||
|
fi
|
||||||
|
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Dloader.path=${BASE_DIR}/plugins/health,${BASE_DIR}/plugins/cmdb"
|
||||||
|
JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"
|
||||||
|
JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/${SERVER}.jar"
|
||||||
|
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
|
||||||
|
JAVA_OPT="${JAVA_OPT} --spring.config.additional-location=${CUSTOM_SEARCH_LOCATIONS}"
|
||||||
|
JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml"
|
||||||
|
JAVA_OPT="${JAVA_OPT} --server.max-http-header-size=524288"
|
||||||
|
|
||||||
|
if [ ! -d "${BASE_DIR}/logs" ]; then
|
||||||
|
mkdir ${BASE_DIR}/logs
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$JAVA ${JAVA_OPT}"
|
||||||
|
|
||||||
|
if [[ "${MODE}" == "standalone" ]]; then
|
||||||
|
echo "nacos is starting with standalone"
|
||||||
|
else
|
||||||
|
echo "nacos is starting with cluster"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check the start.out log output file
|
||||||
|
if [ ! -f "${BASE_DIR}/logs/start.out" ]; then
|
||||||
|
touch "${BASE_DIR}/logs/start.out"
|
||||||
|
fi
|
||||||
|
# start
|
||||||
|
echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 &
|
||||||
|
$JAVA ${JAVA_OPT} nacos.nacos
|
27
nacos/conf/1.4.0-ipv6_support-update.sql
Normal file
27
nacos/conf/1.4.0-ipv6_support-update.sql
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ALTER TABLE `config_info_tag`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
|
||||||
|
|
||||||
|
ALTER TABLE `his_config_info`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL AFTER `src_user`;
|
||||||
|
|
||||||
|
ALTER TABLE `config_info`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
|
||||||
|
|
||||||
|
ALTER TABLE `config_info_beta`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
|
189
nacos/conf/application.properties
Normal file
189
nacos/conf/application.properties
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
#
|
||||||
|
# Copyright 1999-2021 Alibaba Group Holding Ltd.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
#*************** Spring Boot Related Configurations ***************#
|
||||||
|
### Default web context path:
|
||||||
|
server.servlet.contextPath=/nacos
|
||||||
|
### Include message field
|
||||||
|
server.error.include-message=ALWAYS
|
||||||
|
### Default web server port:
|
||||||
|
server.port=8848
|
||||||
|
|
||||||
|
#*************** Network Related Configurations ***************#
|
||||||
|
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
|
||||||
|
# nacos.inetutils.prefer-hostname-over-ip=false
|
||||||
|
|
||||||
|
### Specify local server's IP:
|
||||||
|
# nacos.inetutils.ip-address=
|
||||||
|
|
||||||
|
|
||||||
|
#*************** Config Module Related Configurations ***************#
|
||||||
|
### If use MySQL as datasource:
|
||||||
|
# spring.datasource.platform=mysql
|
||||||
|
|
||||||
|
### Count of DB:
|
||||||
|
# db.num=1
|
||||||
|
|
||||||
|
### Connect URL of DB:
|
||||||
|
# db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
|
||||||
|
# db.user.0=nacos
|
||||||
|
# db.password.0=nacos
|
||||||
|
|
||||||
|
### Connection pool configuration: hikariCP
|
||||||
|
db.pool.config.connectionTimeout=30000
|
||||||
|
db.pool.config.validationTimeout=10000
|
||||||
|
db.pool.config.maximumPoolSize=20
|
||||||
|
db.pool.config.minimumIdle=2
|
||||||
|
|
||||||
|
#*************** Naming Module Related Configurations ***************#
|
||||||
|
### Data dispatch task execution period in milliseconds:
|
||||||
|
# nacos.naming.distro.taskDispatchPeriod=200
|
||||||
|
|
||||||
|
### Data count of batch sync task:
|
||||||
|
# nacos.naming.distro.batchSyncKeyCount=1000
|
||||||
|
|
||||||
|
### Retry delay in milliseconds if sync task failed:
|
||||||
|
# nacos.naming.distro.syncRetryDelay=5000
|
||||||
|
|
||||||
|
### If enable data warmup. If set to false, the server would accept request without local data preparation:
|
||||||
|
# nacos.naming.data.warmup=true
|
||||||
|
|
||||||
|
### If enable the instance auto expiration, kind like of health check of instance:
|
||||||
|
# nacos.naming.expireInstance=true
|
||||||
|
|
||||||
|
nacos.naming.empty-service.auto-clean=true
|
||||||
|
nacos.naming.empty-service.clean.initial-delay-ms=50000
|
||||||
|
nacos.naming.empty-service.clean.period-time-ms=30000
|
||||||
|
|
||||||
|
|
||||||
|
#*************** CMDB Module Related Configurations ***************#
|
||||||
|
### The interval to dump external CMDB in seconds:
|
||||||
|
# nacos.cmdb.dumpTaskInterval=3600
|
||||||
|
|
||||||
|
### The interval of polling data change event in seconds:
|
||||||
|
# nacos.cmdb.eventTaskInterval=10
|
||||||
|
|
||||||
|
### The interval of loading labels in seconds:
|
||||||
|
# nacos.cmdb.labelTaskInterval=300
|
||||||
|
|
||||||
|
### If turn on data loading task:
|
||||||
|
# nacos.cmdb.loadDataAtStart=false
|
||||||
|
|
||||||
|
|
||||||
|
#*************** Metrics Related Configurations ***************#
|
||||||
|
### Metrics for prometheus
|
||||||
|
#management.endpoints.web.exposure.include=*
|
||||||
|
|
||||||
|
### Metrics for elastic search
|
||||||
|
management.metrics.export.elastic.enabled=false
|
||||||
|
#management.metrics.export.elastic.host=http://localhost:9200
|
||||||
|
|
||||||
|
### Metrics for influx
|
||||||
|
management.metrics.export.influx.enabled=false
|
||||||
|
#management.metrics.export.influx.db=springboot
|
||||||
|
#management.metrics.export.influx.uri=http://localhost:8086
|
||||||
|
#management.metrics.export.influx.auto-create-db=true
|
||||||
|
#management.metrics.export.influx.consistency=one
|
||||||
|
#management.metrics.export.influx.compressed=true
|
||||||
|
|
||||||
|
#*************** Access Log Related Configurations ***************#
|
||||||
|
### If turn on the access log:
|
||||||
|
server.tomcat.accesslog.enabled=true
|
||||||
|
|
||||||
|
### The access log pattern:
|
||||||
|
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
|
||||||
|
|
||||||
|
### The directory of access log:
|
||||||
|
server.tomcat.basedir=file:.
|
||||||
|
|
||||||
|
#*************** Access Control Related Configurations ***************#
|
||||||
|
### If enable spring security, this option is deprecated in 1.2.0:
|
||||||
|
#spring.security.enabled=false
|
||||||
|
|
||||||
|
### The ignore urls of auth, is deprecated in 1.2.0:
|
||||||
|
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||||
|
|
||||||
|
### The auth system to use, currently only 'nacos' is supported:
|
||||||
|
nacos.core.auth.system.type=nacos
|
||||||
|
|
||||||
|
### If turn on auth system:
|
||||||
|
nacos.core.auth.enabled=false
|
||||||
|
|
||||||
|
### The token expiration in seconds:
|
||||||
|
nacos.core.auth.default.token.expire.seconds=18000
|
||||||
|
|
||||||
|
### The default token:
|
||||||
|
#nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
|
||||||
|
|
||||||
|
### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
|
||||||
|
nacos.core.auth.caching.enabled=true
|
||||||
|
|
||||||
|
### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
|
||||||
|
nacos.core.auth.enable.userAgentAuthWhite=false
|
||||||
|
|
||||||
|
### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
|
||||||
|
### The two properties is the white list for auth and used by identity the request from other server.
|
||||||
|
nacos.core.auth.server.identity.key=
|
||||||
|
nacos.core.auth.server.identity.value=
|
||||||
|
|
||||||
|
#*************** Istio Related Configurations ***************#
|
||||||
|
### If turn on the MCP server:
|
||||||
|
nacos.istio.mcp.server.enabled=false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###*************** Add from 1.3.0 ***************###
|
||||||
|
|
||||||
|
|
||||||
|
#*************** Core Related Configurations ***************#
|
||||||
|
|
||||||
|
### set the WorkerID manually
|
||||||
|
# nacos.core.snowflake.worker-id=
|
||||||
|
|
||||||
|
### Member-MetaData
|
||||||
|
# nacos.core.member.meta.site=
|
||||||
|
# nacos.core.member.meta.adweight=
|
||||||
|
# nacos.core.member.meta.weight=
|
||||||
|
|
||||||
|
### MemberLookup
|
||||||
|
### Addressing pattern category, If set, the priority is highest
|
||||||
|
# nacos.core.member.lookup.type=[file,address-server]
|
||||||
|
## Set the cluster list with a configuration file or command-line argument
|
||||||
|
# nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809
|
||||||
|
## for AddressServerMemberLookup
|
||||||
|
# Maximum number of retries to query the address server upon initialization
|
||||||
|
# nacos.core.address-server.retry=5
|
||||||
|
## Server domain name address of [address-server] mode
|
||||||
|
# address.server.domain=jmenv.tbsite.net
|
||||||
|
## Server port of [address-server] mode
|
||||||
|
# address.server.port=8080
|
||||||
|
## Request address of [address-server] mode
|
||||||
|
# address.server.url=/nacos/serverlist
|
||||||
|
|
||||||
|
#*************** JRaft Related Configurations ***************#
|
||||||
|
|
||||||
|
### Sets the Raft cluster election timeout, default value is 5 second
|
||||||
|
# nacos.core.protocol.raft.data.election_timeout_ms=5000
|
||||||
|
### Sets the amount of time the Raft snapshot will execute periodically, default is 30 minute
|
||||||
|
# nacos.core.protocol.raft.data.snapshot_interval_secs=30
|
||||||
|
### raft internal worker threads
|
||||||
|
# nacos.core.protocol.raft.data.core_thread_num=8
|
||||||
|
### Number of threads required for raft business request processing
|
||||||
|
# nacos.core.protocol.raft.data.cli_service_thread_num=4
|
||||||
|
### raft linear read strategy. Safe linear reads are used by default, that is, the Leader tenure is confirmed by heartbeat
|
||||||
|
# nacos.core.protocol.raft.data.read_index_type=ReadOnlySafe
|
||||||
|
### rpc request timeout, default 5 seconds
|
||||||
|
# nacos.core.protocol.raft.data.rpc_request_timeout_ms=5000
|
184
nacos/conf/application.properties.example
Normal file
184
nacos/conf/application.properties.example
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
#
|
||||||
|
# Copyright 1999-2021 Alibaba Group Holding Ltd.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
#*************** Spring Boot Related Configurations ***************#
|
||||||
|
### Default web context path:
|
||||||
|
server.servlet.contextPath=/nacos
|
||||||
|
### Include message field
|
||||||
|
server.error.include-message=ALWAYS
|
||||||
|
### Default web server port:
|
||||||
|
server.port=8848
|
||||||
|
|
||||||
|
#*************** Network Related Configurations ***************#
|
||||||
|
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
|
||||||
|
# nacos.inetutils.prefer-hostname-over-ip=false
|
||||||
|
|
||||||
|
### Specify local server's IP:
|
||||||
|
# nacos.inetutils.ip-address=
|
||||||
|
|
||||||
|
|
||||||
|
#*************** Config Module Related Configurations ***************#
|
||||||
|
### If use MySQL as datasource:
|
||||||
|
# spring.datasource.platform=mysql
|
||||||
|
|
||||||
|
### Count of DB:
|
||||||
|
# db.num=1
|
||||||
|
|
||||||
|
### Connect URL of DB:
|
||||||
|
# db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
|
||||||
|
# db.user.0=nacos
|
||||||
|
# db.password.0=nacos
|
||||||
|
|
||||||
|
|
||||||
|
#*************** Naming Module Related Configurations ***************#
|
||||||
|
### Data dispatch task execution period in milliseconds:
|
||||||
|
# nacos.naming.distro.taskDispatchPeriod=200
|
||||||
|
|
||||||
|
### Data count of batch sync task:
|
||||||
|
# nacos.naming.distro.batchSyncKeyCount=1000
|
||||||
|
|
||||||
|
### Retry delay in milliseconds if sync task failed:
|
||||||
|
# nacos.naming.distro.syncRetryDelay=5000
|
||||||
|
|
||||||
|
### If enable data warmup. If set to false, the server would accept request without local data preparation:
|
||||||
|
# nacos.naming.data.warmup=true
|
||||||
|
|
||||||
|
### If enable the instance auto expiration, kind like of health check of instance:
|
||||||
|
# nacos.naming.expireInstance=true
|
||||||
|
|
||||||
|
nacos.naming.empty-service.auto-clean=true
|
||||||
|
nacos.naming.empty-service.clean.initial-delay-ms=50000
|
||||||
|
nacos.naming.empty-service.clean.period-time-ms=30000
|
||||||
|
|
||||||
|
|
||||||
|
#*************** CMDB Module Related Configurations ***************#
|
||||||
|
### The interval to dump external CMDB in seconds:
|
||||||
|
# nacos.cmdb.dumpTaskInterval=3600
|
||||||
|
|
||||||
|
### The interval of polling data change event in seconds:
|
||||||
|
# nacos.cmdb.eventTaskInterval=10
|
||||||
|
|
||||||
|
### The interval of loading labels in seconds:
|
||||||
|
# nacos.cmdb.labelTaskInterval=300
|
||||||
|
|
||||||
|
### If turn on data loading task:
|
||||||
|
# nacos.cmdb.loadDataAtStart=false
|
||||||
|
|
||||||
|
|
||||||
|
#*************** Metrics Related Configurations ***************#
|
||||||
|
### Metrics for prometheus
|
||||||
|
#management.endpoints.web.exposure.include=*
|
||||||
|
|
||||||
|
### Metrics for elastic search
|
||||||
|
management.metrics.export.elastic.enabled=false
|
||||||
|
#management.metrics.export.elastic.host=http://localhost:9200
|
||||||
|
|
||||||
|
### Metrics for influx
|
||||||
|
management.metrics.export.influx.enabled=false
|
||||||
|
#management.metrics.export.influx.db=springboot
|
||||||
|
#management.metrics.export.influx.uri=http://localhost:8086
|
||||||
|
#management.metrics.export.influx.auto-create-db=true
|
||||||
|
#management.metrics.export.influx.consistency=one
|
||||||
|
#management.metrics.export.influx.compressed=true
|
||||||
|
|
||||||
|
#*************** Access Log Related Configurations ***************#
|
||||||
|
### If turn on the access log:
|
||||||
|
server.tomcat.accesslog.enabled=true
|
||||||
|
|
||||||
|
### The access log pattern:
|
||||||
|
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
|
||||||
|
|
||||||
|
### The directory of access log:
|
||||||
|
server.tomcat.basedir=file:.
|
||||||
|
|
||||||
|
#*************** Access Control Related Configurations ***************#
|
||||||
|
### If enable spring security, this option is deprecated in 1.2.0:
|
||||||
|
#spring.security.enabled=false
|
||||||
|
|
||||||
|
### The ignore urls of auth, is deprecated in 1.2.0:
|
||||||
|
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||||
|
|
||||||
|
### The auth system to use, currently only 'nacos' is supported:
|
||||||
|
nacos.core.auth.system.type=nacos
|
||||||
|
|
||||||
|
### If turn on auth system:
|
||||||
|
nacos.core.auth.enabled=false
|
||||||
|
|
||||||
|
### The token expiration in seconds:
|
||||||
|
nacos.core.auth.default.token.expire.seconds=18000
|
||||||
|
|
||||||
|
### The default token:
|
||||||
|
#nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
|
||||||
|
|
||||||
|
### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
|
||||||
|
nacos.core.auth.caching.enabled=true
|
||||||
|
|
||||||
|
### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
|
||||||
|
nacos.core.auth.enable.userAgentAuthWhite=false
|
||||||
|
|
||||||
|
### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
|
||||||
|
### The two properties is the white list for auth and used by identity the request from other server.
|
||||||
|
#nacos.core.auth.server.identity.key=example
|
||||||
|
#nacos.core.auth.server.identity.value=example
|
||||||
|
|
||||||
|
#*************** Istio Related Configurations ***************#
|
||||||
|
### If turn on the MCP server:
|
||||||
|
nacos.istio.mcp.server.enabled=false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###*************** Add from 1.3.0 ***************###
|
||||||
|
|
||||||
|
|
||||||
|
#*************** Core Related Configurations ***************#
|
||||||
|
|
||||||
|
### set the WorkerID manually
|
||||||
|
# nacos.core.snowflake.worker-id=
|
||||||
|
|
||||||
|
### Member-MetaData
|
||||||
|
# nacos.core.member.meta.site=
|
||||||
|
# nacos.core.member.meta.adweight=
|
||||||
|
# nacos.core.member.meta.weight=
|
||||||
|
|
||||||
|
### MemberLookup
|
||||||
|
### Addressing pattern category, If set, the priority is highest
|
||||||
|
# nacos.core.member.lookup.type=[file,address-server]
|
||||||
|
## Set the cluster list with a configuration file or command-line argument
|
||||||
|
# nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809
|
||||||
|
## for AddressServerMemberLookup
|
||||||
|
# Maximum number of retries to query the address server upon initialization
|
||||||
|
# nacos.core.address-server.retry=5
|
||||||
|
## Server domain name address of [address-server] mode
|
||||||
|
# address.server.domain=jmenv.tbsite.net
|
||||||
|
## Server port of [address-server] mode
|
||||||
|
# address.server.port=8080
|
||||||
|
## Request address of [address-server] mode
|
||||||
|
# address.server.url=/nacos/serverlist
|
||||||
|
|
||||||
|
#*************** JRaft Related Configurations ***************#
|
||||||
|
|
||||||
|
### Sets the Raft cluster election timeout, default value is 5 second
|
||||||
|
# nacos.core.protocol.raft.data.election_timeout_ms=5000
|
||||||
|
### Sets the amount of time the Raft snapshot will execute periodically, default is 30 minute
|
||||||
|
# nacos.core.protocol.raft.data.snapshot_interval_secs=30
|
||||||
|
### raft internal worker threads
|
||||||
|
# nacos.core.protocol.raft.data.core_thread_num=8
|
||||||
|
### Number of threads required for raft business request processing
|
||||||
|
# nacos.core.protocol.raft.data.cli_service_thread_num=4
|
||||||
|
### raft linear read strategy. Safe linear reads are used by default, that is, the Leader tenure is confirmed by heartbeat
|
||||||
|
# nacos.core.protocol.raft.data.read_index_type=ReadOnlySafe
|
||||||
|
### rpc request timeout, default 5 seconds
|
||||||
|
# nacos.core.protocol.raft.data.rpc_request_timeout_ms=5000
|
21
nacos/conf/cluster.conf.example
Normal file
21
nacos/conf/cluster.conf.example
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
#it is ip
|
||||||
|
#example
|
||||||
|
192.168.16.101:8847
|
||||||
|
192.168.16.102
|
||||||
|
192.168.16.103
|
642
nacos/conf/nacos-logback.xml
Normal file
642
nacos/conf/nacos-logback.xml
Normal file
@ -0,0 +1,642 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<configuration scan="true" scanPeriod="10 seconds">
|
||||||
|
|
||||||
|
<springProperty scope="context" name="logPath" source="nacos.logs.path" defaultValue="${nacos.home}/logs"/>
|
||||||
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
|
|
||||||
|
<appender name="cmdb-main"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${nacos.home}/logs/cmdb-main.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${nacos.home}/logs/cmdb-main.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="naming-server"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/naming-server.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/naming-server.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="async-naming-server" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
|
<discardingThreshold>0</discardingThreshold>
|
||||||
|
<queueSize>1024</queueSize>
|
||||||
|
<neverBlock>true</neverBlock>
|
||||||
|
<appender-ref ref="naming-server"/>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="naming-raft"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/naming-raft.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/naming-raft.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="async-naming-raft" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
|
<discardingThreshold>0</discardingThreshold>
|
||||||
|
<queueSize>1024</queueSize>
|
||||||
|
<neverBlock>true</neverBlock>
|
||||||
|
<appender-ref ref="naming-raft"/>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
|
<appender name="naming-distro"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/naming-distro.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/naming-distro.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="async-naming-distro" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
|
<discardingThreshold>0</discardingThreshold>
|
||||||
|
<queueSize>1024</queueSize>
|
||||||
|
<neverBlock>true</neverBlock>
|
||||||
|
<appender-ref ref="naming-distro"/>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="naming-event"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/naming-event.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/naming-event.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="async-naming-event" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
|
<discardingThreshold>0</discardingThreshold>
|
||||||
|
<queueSize>1024</queueSize>
|
||||||
|
<neverBlock>true</neverBlock>
|
||||||
|
<appender-ref ref="naming-event"/>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="naming-push"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/naming-push.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/naming-push.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="naming-rt"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/naming-rt.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/naming-rt.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%msg%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="naming-performance"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/naming-performance.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/naming-performance.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!--config module logback config-->
|
||||||
|
<appender name="dumpFile"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-dump.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-dump.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="pullFile"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-pull.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-pull.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>20MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>128MB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="fatalFile"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-fatal.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-fatal.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>20MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>128MB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="memoryFile"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-memory.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-memory.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>20MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>128MB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="pullCheckFile"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-pull-check.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-pull-check.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%msg%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="clientLog"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-client-request.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-client-request.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date|%msg%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="traceLog"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-trace.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-trace.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date|%msg%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="notifyLog"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-notify.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-notify.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>1GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="startLog"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/config-server.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/config-server.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>50MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>512MB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="rootFile"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/nacos.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/nacos.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>50MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>512MB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="nacos-address"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/nacos-address.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/nacos-address.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="istio-main"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/istio-main.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/istio-main.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="core-auth"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/core-auth.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/core-auth.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="protocol-raft"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/protocol-raft.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/protocol-raft.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="protocol-distro"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/protocol-distro.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/protocol-distro.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="nacos-cluster"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/nacos-cluster.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/nacos-cluster.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="alipay-jraft"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/alipay-jraft.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/alipay-jraft.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>2GB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>7GB</totalSizeCap>
|
||||||
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<Pattern>%date %level %msg%n%n</Pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.address.main" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="nacos-address"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.cmdb.main" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="cmdb-main"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.naming.main" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="async-naming-server"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.naming.raft" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="async-naming-raft"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.naming.distro" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="async-naming-distro"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.naming.event" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="async-naming-event"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.naming.push" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="naming-push"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.naming.rt" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="naming-rt"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.naming.performance" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="naming-performance"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.config.dumpLog" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="dumpFile"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.config.pullLog" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="pullFile"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.config.pullCheckLog" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="pullCheckFile"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.config.fatal" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="fatalFile"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.alibaba.nacos.config.monitorLog" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="memoryFile"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.config.clientLog" additivity="false">
|
||||||
|
<level value="info"/>
|
||||||
|
<appender-ref ref="clientLog"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.config.notifyLog" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="notifyLog"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.config.traceLog" additivity="false">
|
||||||
|
<level value="info"/>
|
||||||
|
<appender-ref ref="traceLog"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.config.startLog" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="startLog"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.istio.main" additivity="false">
|
||||||
|
<level value="DEBUG"/>
|
||||||
|
<appender-ref ref="istio-main"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.core.auth" additivity="false">
|
||||||
|
<level value="DEBUG"/>
|
||||||
|
<appender-ref ref="core-auth"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.core.protocol.raft" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="protocol-raft"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alipay.sofa.jraft" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="alipay-jraft"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.core.protocol.distro" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="protocol-distro"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.core.cluster" additivity="false">
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="nacos-cluster"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<springProfile name="standalone">
|
||||||
|
<logger name="org.springframework">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="INFO"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="org.apache.catalina.startup.DigesterFactory">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="INFO"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="org.apache.catalina.util.LifecycleBase">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="ERROR"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="org.apache.coyote.http11.Http11NioProtocol">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="WARN"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="org.apache.tomcat.util.net.NioSelectorPool">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="WARN"/>
|
||||||
|
</logger>
|
||||||
|
</springProfile>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.core.listener.StartingApplicationListener">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="INFO"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.common.notify.NotifyCenter">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="INFO"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.sys.file.WatchFileCenter">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="INFO"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="com.alibaba.nacos.common.executor.ThreadPoolManager">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<level value="INFO"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root>
|
||||||
|
<level value="INFO"/>
|
||||||
|
<appender-ref ref="rootFile"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
|
|
218
nacos/conf/nacos-mysql.sql
Normal file
218
nacos/conf/nacos-mysql.sql
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = config_info */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `config_info` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
||||||
|
`group_id` varchar(255) DEFAULT NULL,
|
||||||
|
`content` longtext NOT NULL COMMENT 'content',
|
||||||
|
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
||||||
|
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
|
`src_user` text COMMENT 'source user',
|
||||||
|
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
|
||||||
|
`app_name` varchar(128) DEFAULT NULL,
|
||||||
|
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
||||||
|
`c_desc` varchar(256) DEFAULT NULL,
|
||||||
|
`c_use` varchar(64) DEFAULT NULL,
|
||||||
|
`effect` varchar(64) DEFAULT NULL,
|
||||||
|
`type` varchar(64) DEFAULT NULL,
|
||||||
|
`c_schema` text,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = config_info_aggr */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `config_info_aggr` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
||||||
|
`group_id` varchar(255) NOT NULL COMMENT 'group_id',
|
||||||
|
`datum_id` varchar(255) NOT NULL COMMENT 'datum_id',
|
||||||
|
`content` longtext NOT NULL COMMENT '内容',
|
||||||
|
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
|
||||||
|
`app_name` varchar(128) DEFAULT NULL,
|
||||||
|
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = config_info_beta */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `config_info_beta` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
||||||
|
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
||||||
|
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
||||||
|
`content` longtext NOT NULL COMMENT 'content',
|
||||||
|
`beta_ips` varchar(1024) DEFAULT NULL COMMENT 'betaIps',
|
||||||
|
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
||||||
|
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
|
`src_user` text COMMENT 'source user',
|
||||||
|
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
|
||||||
|
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = config_info_tag */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `config_info_tag` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
||||||
|
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
||||||
|
`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
|
||||||
|
`tag_id` varchar(128) NOT NULL COMMENT 'tag_id',
|
||||||
|
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
||||||
|
`content` longtext NOT NULL COMMENT 'content',
|
||||||
|
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
||||||
|
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
|
`src_user` text COMMENT 'source user',
|
||||||
|
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = config_tags_relation */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `config_tags_relation` (
|
||||||
|
`id` bigint(20) NOT NULL COMMENT 'id',
|
||||||
|
`tag_name` varchar(128) NOT NULL COMMENT 'tag_name',
|
||||||
|
`tag_type` varchar(64) DEFAULT NULL COMMENT 'tag_type',
|
||||||
|
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
||||||
|
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
||||||
|
`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
|
||||||
|
`nid` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
PRIMARY KEY (`nid`),
|
||||||
|
UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
|
||||||
|
KEY `idx_tenant_id` (`tenant_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = group_capacity */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `group_capacity` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`group_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
|
||||||
|
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
||||||
|
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
||||||
|
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||||
|
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',
|
||||||
|
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
||||||
|
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
||||||
|
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_group_id` (`group_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = his_config_info */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `his_config_info` (
|
||||||
|
`id` bigint(64) unsigned NOT NULL,
|
||||||
|
`nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`data_id` varchar(255) NOT NULL,
|
||||||
|
`group_id` varchar(128) NOT NULL,
|
||||||
|
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
||||||
|
`content` longtext NOT NULL,
|
||||||
|
`md5` varchar(32) DEFAULT NULL,
|
||||||
|
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`src_user` text,
|
||||||
|
`src_ip` varchar(50) DEFAULT NULL,
|
||||||
|
`op_type` char(10) DEFAULT NULL,
|
||||||
|
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
||||||
|
PRIMARY KEY (`nid`),
|
||||||
|
KEY `idx_gmt_create` (`gmt_create`),
|
||||||
|
KEY `idx_gmt_modified` (`gmt_modified`),
|
||||||
|
KEY `idx_did` (`data_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* 数据库全名 = nacos_config */
|
||||||
|
/* 表名称 = tenant_capacity */
|
||||||
|
/******************************************/
|
||||||
|
CREATE TABLE `tenant_capacity` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`tenant_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID',
|
||||||
|
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
||||||
|
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
||||||
|
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||||
|
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',
|
||||||
|
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
||||||
|
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
||||||
|
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_tenant_id` (`tenant_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `tenant_info` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
`kp` varchar(128) NOT NULL COMMENT 'kp',
|
||||||
|
`tenant_id` varchar(128) default '' COMMENT 'tenant_id',
|
||||||
|
`tenant_name` varchar(128) default '' COMMENT 'tenant_name',
|
||||||
|
`tenant_desc` varchar(256) DEFAULT NULL COMMENT 'tenant_desc',
|
||||||
|
`create_source` varchar(32) DEFAULT NULL COMMENT 'create_source',
|
||||||
|
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
|
||||||
|
`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
|
||||||
|
KEY `idx_tenant_id` (`tenant_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';
|
||||||
|
|
||||||
|
CREATE TABLE `users` (
|
||||||
|
`username` varchar(50) NOT NULL PRIMARY KEY,
|
||||||
|
`password` varchar(500) NOT NULL,
|
||||||
|
`enabled` boolean NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `roles` (
|
||||||
|
`username` varchar(50) NOT NULL,
|
||||||
|
`role` varchar(50) NOT NULL,
|
||||||
|
UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `permissions` (
|
||||||
|
`role` varchar(50) NOT NULL,
|
||||||
|
`resource` varchar(255) NOT NULL,
|
||||||
|
`action` varchar(8) NOT NULL,
|
||||||
|
UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
||||||
|
|
||||||
|
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
228
nacos/conf/schema.sql
Normal file
228
nacos/conf/schema.sql
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
CREATE SCHEMA nacos AUTHORIZATION nacos;
|
||||||
|
|
||||||
|
CREATE TABLE config_info (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
tenant_id varchar(128) default '',
|
||||||
|
app_name varchar(128),
|
||||||
|
content CLOB,
|
||||||
|
md5 varchar(32) DEFAULT NULL,
|
||||||
|
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||||
|
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||||
|
src_user varchar(128) DEFAULT NULL,
|
||||||
|
src_ip varchar(50) DEFAULT NULL,
|
||||||
|
c_desc varchar(256) DEFAULT NULL,
|
||||||
|
c_use varchar(64) DEFAULT NULL,
|
||||||
|
effect varchar(64) DEFAULT NULL,
|
||||||
|
type varchar(64) DEFAULT NULL,
|
||||||
|
c_schema LONG VARCHAR DEFAULT NULL,
|
||||||
|
constraint configinfo_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_configinfo_datagrouptenant UNIQUE (data_id,group_id,tenant_id));
|
||||||
|
|
||||||
|
CREATE INDEX configinfo_dataid_key_idx ON config_info(data_id);
|
||||||
|
CREATE INDEX configinfo_groupid_key_idx ON config_info(group_id);
|
||||||
|
CREATE INDEX configinfo_dataid_group_key_idx ON config_info(data_id, group_id);
|
||||||
|
|
||||||
|
CREATE TABLE his_config_info (
|
||||||
|
id bigint NOT NULL,
|
||||||
|
nid bigint NOT NULL generated by default as identity,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
tenant_id varchar(128) default '',
|
||||||
|
app_name varchar(128),
|
||||||
|
content CLOB,
|
||||||
|
md5 varchar(32) DEFAULT NULL,
|
||||||
|
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
|
||||||
|
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
|
||||||
|
src_user varchar(128),
|
||||||
|
src_ip varchar(50) DEFAULT NULL,
|
||||||
|
op_type char(10) DEFAULT NULL,
|
||||||
|
constraint hisconfiginfo_nid_key PRIMARY KEY (nid));
|
||||||
|
|
||||||
|
CREATE INDEX hisconfiginfo_dataid_key_idx ON his_config_info(data_id);
|
||||||
|
CREATE INDEX hisconfiginfo_gmt_create_idx ON his_config_info(gmt_create);
|
||||||
|
CREATE INDEX hisconfiginfo_gmt_modified_idx ON his_config_info(gmt_modified);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE config_info_beta (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
tenant_id varchar(128) default '',
|
||||||
|
app_name varchar(128),
|
||||||
|
content CLOB,
|
||||||
|
beta_ips varchar(1024),
|
||||||
|
md5 varchar(32) DEFAULT NULL,
|
||||||
|
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||||
|
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||||
|
src_user varchar(128),
|
||||||
|
src_ip varchar(50) DEFAULT NULL,
|
||||||
|
constraint configinfobeta_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_configinfobeta_datagrouptenant UNIQUE (data_id,group_id,tenant_id));
|
||||||
|
|
||||||
|
CREATE TABLE config_info_tag (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
tenant_id varchar(128) default '',
|
||||||
|
tag_id varchar(128) NOT NULL,
|
||||||
|
app_name varchar(128),
|
||||||
|
content CLOB,
|
||||||
|
md5 varchar(32) DEFAULT NULL,
|
||||||
|
gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||||
|
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||||
|
src_user varchar(128),
|
||||||
|
src_ip varchar(50) DEFAULT NULL,
|
||||||
|
constraint configinfotag_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_configinfotag_datagrouptenanttag UNIQUE (data_id,group_id,tenant_id,tag_id));
|
||||||
|
|
||||||
|
CREATE TABLE config_info_aggr (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
tenant_id varchar(128) default '',
|
||||||
|
datum_id varchar(255) NOT NULL,
|
||||||
|
app_name varchar(128),
|
||||||
|
content CLOB,
|
||||||
|
gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||||
|
constraint configinfoaggr_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_configinfoaggr_datagrouptenantdatum UNIQUE (data_id,group_id,tenant_id,datum_id));
|
||||||
|
|
||||||
|
CREATE TABLE app_list (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
app_name varchar(128) NOT NULL,
|
||||||
|
is_dynamic_collect_disabled smallint DEFAULT 0,
|
||||||
|
last_sub_info_collected_time timestamp DEFAULT '1970-01-01 08:00:00.0',
|
||||||
|
sub_info_lock_owner varchar(128),
|
||||||
|
sub_info_lock_time timestamp DEFAULT '1970-01-01 08:00:00.0',
|
||||||
|
constraint applist_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_appname UNIQUE (app_name));
|
||||||
|
|
||||||
|
CREATE TABLE app_configdata_relation_subs (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
app_name varchar(128) NOT NULL,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||||
|
constraint configdatarelationsubs_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_app_sub_config_datagroup UNIQUE (app_name, data_id, group_id));
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE app_configdata_relation_pubs (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
app_name varchar(128) NOT NULL,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||||
|
constraint configdatarelationpubs_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_app_pub_config_datagroup UNIQUE (app_name, data_id, group_id));
|
||||||
|
|
||||||
|
CREATE TABLE config_tags_relation (
|
||||||
|
id bigint NOT NULL,
|
||||||
|
tag_name varchar(128) NOT NULL,
|
||||||
|
tag_type varchar(64) DEFAULT NULL,
|
||||||
|
data_id varchar(255) NOT NULL,
|
||||||
|
group_id varchar(128) NOT NULL,
|
||||||
|
tenant_id varchar(128) DEFAULT '',
|
||||||
|
nid bigint NOT NULL generated by default as identity,
|
||||||
|
constraint config_tags_id_key PRIMARY KEY (nid),
|
||||||
|
constraint uk_configtagrelation_configidtag UNIQUE (id, tag_name, tag_type));
|
||||||
|
|
||||||
|
CREATE INDEX config_tags_tenant_id_idx ON config_tags_relation(tenant_id);
|
||||||
|
|
||||||
|
CREATE TABLE group_capacity (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
group_id varchar(128) DEFAULT '',
|
||||||
|
quota int DEFAULT 0,
|
||||||
|
usage int DEFAULT 0,
|
||||||
|
max_size int DEFAULT 0,
|
||||||
|
max_aggr_count int DEFAULT 0,
|
||||||
|
max_aggr_size int DEFAULT 0,
|
||||||
|
max_history_count int DEFAULT 0,
|
||||||
|
gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
|
||||||
|
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||||
|
constraint group_capacity_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_group_id UNIQUE (group_id));
|
||||||
|
|
||||||
|
CREATE TABLE tenant_capacity (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
tenant_id varchar(128) DEFAULT '',
|
||||||
|
quota int DEFAULT 0,
|
||||||
|
usage int DEFAULT 0,
|
||||||
|
max_size int DEFAULT 0,
|
||||||
|
max_aggr_count int DEFAULT 0,
|
||||||
|
max_aggr_size int DEFAULT 0,
|
||||||
|
max_history_count int DEFAULT 0,
|
||||||
|
gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
|
||||||
|
gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
|
||||||
|
constraint tenant_capacity_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_tenant_id UNIQUE (tenant_id));
|
||||||
|
|
||||||
|
CREATE TABLE tenant_info (
|
||||||
|
id bigint NOT NULL generated by default as identity,
|
||||||
|
kp varchar(128) NOT NULL,
|
||||||
|
tenant_id varchar(128) DEFAULT '',
|
||||||
|
tenant_name varchar(128) DEFAULT '',
|
||||||
|
tenant_desc varchar(256) DEFAULT NULL,
|
||||||
|
create_source varchar(32) DEFAULT NULL,
|
||||||
|
gmt_create bigint NOT NULL,
|
||||||
|
gmt_modified bigint NOT NULL,
|
||||||
|
constraint tenant_info_id_key PRIMARY KEY (id),
|
||||||
|
constraint uk_tenant_info_kptenantid UNIQUE (kp,tenant_id));
|
||||||
|
CREATE INDEX tenant_info_tenant_id_idx ON tenant_info(tenant_id);
|
||||||
|
|
||||||
|
CREATE TABLE users (
|
||||||
|
username varchar(50) NOT NULL PRIMARY KEY,
|
||||||
|
password varchar(500) NOT NULL,
|
||||||
|
enabled boolean NOT NULL DEFAULT true
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE roles (
|
||||||
|
username varchar(50) NOT NULL,
|
||||||
|
role varchar(50) NOT NULL,
|
||||||
|
constraint uk_username_role UNIQUE (username,role)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE permissions (
|
||||||
|
role varchar(50) NOT NULL,
|
||||||
|
resource varchar(512) NOT NULL,
|
||||||
|
action varchar(8) NOT NULL,
|
||||||
|
constraint uk_role_permission UNIQUE (role,resource,action)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
||||||
|
|
||||||
|
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* ipv6 support */
|
||||||
|
/******************************************/
|
||||||
|
ALTER TABLE `config_info_tag`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
|
||||||
|
|
||||||
|
ALTER TABLE `his_config_info`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL AFTER `src_user`;
|
||||||
|
|
||||||
|
ALTER TABLE `config_info`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
|
||||||
|
|
||||||
|
ALTER TABLE `config_info_beta`
|
||||||
|
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;
|
9
nacos/data/derby-data/README_DO_NOT_TOUCH_FILES.txt
Normal file
9
nacos/data/derby-data/README_DO_NOT_TOUCH_FILES.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
# *************************************************************************
|
||||||
|
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
|
||||||
|
# *** FILES IN THIS DIRECTORY AND SUBDIRECTORIES CONSTITUTE A DERBY ***
|
||||||
|
# *** DATABASE, WHICH INCLUDES THE DATA (USER AND SYSTEM) AND THE ***
|
||||||
|
# *** FILES NECESSARY FOR DATABASE RECOVERY. ***
|
||||||
|
# *** EDITING, ADDING, OR DELETING ANY OF THESE FILES MAY CAUSE DATA ***
|
||||||
|
# *** CORRUPTION AND LEAVE THE DATABASE IN A NON-RECOVERABLE STATE. ***
|
||||||
|
# *************************************************************************
|
BIN
nacos/data/derby-data/db.lck
Normal file
BIN
nacos/data/derby-data/db.lck
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/dbex.lck
Normal file
BIN
nacos/data/derby-data/dbex.lck
Normal file
Binary file not shown.
8
nacos/data/derby-data/log/README_DO_NOT_TOUCH_FILES.txt
Normal file
8
nacos/data/derby-data/log/README_DO_NOT_TOUCH_FILES.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# *************************************************************************
|
||||||
|
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
|
||||||
|
# *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE RECOVERY ***
|
||||||
|
# *** SYSTEM. EDITING, ADDING, OR DELETING FILES IN THIS DIRECTORY ***
|
||||||
|
# *** WILL CAUSE THE DERBY RECOVERY SYSTEM TO FAIL, LEADING TO ***
|
||||||
|
# *** NON-RECOVERABLE CORRUPT DATABASES. ***
|
||||||
|
# *************************************************************************
|
BIN
nacos/data/derby-data/log/log.ctrl
Normal file
BIN
nacos/data/derby-data/log/log.ctrl
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/log/log1.dat
Normal file
BIN
nacos/data/derby-data/log/log1.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/log/logmirror.ctrl
Normal file
BIN
nacos/data/derby-data/log/logmirror.ctrl
Normal file
Binary file not shown.
8
nacos/data/derby-data/seg0/README_DO_NOT_TOUCH_FILES.txt
Normal file
8
nacos/data/derby-data/seg0/README_DO_NOT_TOUCH_FILES.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# *************************************************************************
|
||||||
|
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
|
||||||
|
# *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE TO STORE ***
|
||||||
|
# *** USER AND SYSTEM DATA. EDITING, ADDING, OR DELETING FILES IN THIS ***
|
||||||
|
# *** DIRECTORY WILL CORRUPT THE ASSOCIATED DERBY DATABASE AND MAKE ***
|
||||||
|
# *** IT NON-RECOVERABLE. ***
|
||||||
|
# *************************************************************************
|
BIN
nacos/data/derby-data/seg0/c10.dat
Normal file
BIN
nacos/data/derby-data/seg0/c10.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c101.dat
Normal file
BIN
nacos/data/derby-data/seg0/c101.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c111.dat
Normal file
BIN
nacos/data/derby-data/seg0/c111.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c121.dat
Normal file
BIN
nacos/data/derby-data/seg0/c121.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c130.dat
Normal file
BIN
nacos/data/derby-data/seg0/c130.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c141.dat
Normal file
BIN
nacos/data/derby-data/seg0/c141.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c150.dat
Normal file
BIN
nacos/data/derby-data/seg0/c150.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c161.dat
Normal file
BIN
nacos/data/derby-data/seg0/c161.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c171.dat
Normal file
BIN
nacos/data/derby-data/seg0/c171.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c180.dat
Normal file
BIN
nacos/data/derby-data/seg0/c180.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c191.dat
Normal file
BIN
nacos/data/derby-data/seg0/c191.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c1a1.dat
Normal file
BIN
nacos/data/derby-data/seg0/c1a1.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c1b1.dat
Normal file
BIN
nacos/data/derby-data/seg0/c1b1.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c1c0.dat
Normal file
BIN
nacos/data/derby-data/seg0/c1c0.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c1d1.dat
Normal file
BIN
nacos/data/derby-data/seg0/c1d1.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c1e0.dat
Normal file
BIN
nacos/data/derby-data/seg0/c1e0.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c1f1.dat
Normal file
BIN
nacos/data/derby-data/seg0/c1f1.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c20.dat
Normal file
BIN
nacos/data/derby-data/seg0/c20.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c200.dat
Normal file
BIN
nacos/data/derby-data/seg0/c200.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c211.dat
Normal file
BIN
nacos/data/derby-data/seg0/c211.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c221.dat
Normal file
BIN
nacos/data/derby-data/seg0/c221.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c230.dat
Normal file
BIN
nacos/data/derby-data/seg0/c230.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c241.dat
Normal file
BIN
nacos/data/derby-data/seg0/c241.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c251.dat
Normal file
BIN
nacos/data/derby-data/seg0/c251.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c260.dat
Normal file
BIN
nacos/data/derby-data/seg0/c260.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c271.dat
Normal file
BIN
nacos/data/derby-data/seg0/c271.dat
Normal file
Binary file not shown.
BIN
nacos/data/derby-data/seg0/c281.dat
Normal file
BIN
nacos/data/derby-data/seg0/c281.dat
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user