Compare commits
131 Commits
v2.1.0-BET
...
master
Author | SHA1 | Date |
---|---|---|
|
ecbdb600f7 | |
|
9f6e41db0c | |
|
40fa086e63 | |
|
f49a9ff0d6 | |
|
26cc6b6056 | |
|
a3795ac461 | |
|
9c93392805 | |
|
bcc778c832 | |
|
baffa99131 | |
|
9e80494a69 | |
|
74df95080f | |
|
e76c828582 | |
|
c82efd39fd | |
|
e4f35a54c5 | |
|
eff0d35f5b | |
|
a24b728c75 | |
|
6a611cbd58 | |
|
d11f709704 | |
|
a61632e219 | |
|
aa991698ea | |
|
cdf8c9904c | |
|
b51f46f96b | |
|
a68691422d | |
|
aac25b9a51 | |
|
41e7f1e916 | |
|
a6c1c09221 | |
|
5b21514ebc | |
|
1c006e1959 | |
|
5a09ed9222 | |
|
f9d8d059f3 | |
|
ae8bb56b56 | |
|
a743c3c1fb | |
|
c82b928d90 | |
|
c4a877c896 | |
|
81fc38a30a | |
|
e084da67f4 | |
|
41f0a89ea9 | |
|
a44186135e | |
|
833e5dc24a | |
|
ea96c1a6ee | |
|
856afc1bb7 | |
|
c71bad8ba3 | |
|
4d891ca4eb | |
|
c150bce691 | |
|
cb9ef49e97 | |
|
a56b001d0d | |
|
efaa0bd6bd | |
|
20a1a9becf | |
|
1ae32a2c8e | |
|
9650d9d4c3 | |
|
fc4d6055a3 | |
|
59c2cbefb9 | |
|
2e43379c4e | |
|
08c2744bf6 | |
|
c80a4f8871 | |
|
ec7f5f3519 | |
|
1356ffa2e8 | |
|
c624cdf95a | |
|
ac86cd43db | |
|
ac214ac776 | |
|
2ba66d0a6d | |
|
04f7f1388a | |
|
5f736945f0 | |
|
ad67009dbf | |
|
d15408685d | |
|
e44dd08c64 | |
|
a9700ade75 | |
|
935faa6884 | |
|
f7386acfe5 | |
|
6e14c48033 | |
|
b897280a55 | |
|
979baf11da | |
|
65315e64d3 | |
|
6187f47f0d | |
|
260e4074b5 | |
|
cd606a75fa | |
|
45deac1690 | |
|
5053f5dd44 | |
|
08a41ee871 | |
|
739fea3b76 | |
|
a10e1fc68c | |
|
332cc6b3fc | |
|
64dd8cbd69 | |
|
2aef0f0a91 | |
|
5ddfd0fa91 | |
|
14d08acf96 | |
|
ead7efddd1 | |
|
b9154172bc | |
|
559d81307e | |
|
b46371e470 | |
|
3c3181b063 | |
|
3ad0c5a7f1 | |
|
5b9741547a | |
|
7229c14c34 | |
|
048a2a4f16 | |
|
ca624f2452 | |
|
e26d0209a6 | |
|
bf60f0ae6b | |
|
b47c79fcb9 | |
|
01891ab9d8 | |
|
5c26172efd | |
|
631d7eeb81 | |
|
114e2a211e | |
|
cc3fca20c6 | |
|
33e52d63dc | |
|
3622d8c65d | |
|
05086aec39 | |
|
6f25e6f67e | |
|
a77f2da932 | |
|
7053906f2c | |
|
c5a58dc637 | |
|
15596a549a | |
|
bb719162b2 | |
|
de15f32e74 | |
|
c404421e5e | |
|
6f28cc3e17 | |
|
3736ce9a58 | |
|
7c6e01857b | |
|
6cff3b6906 | |
|
6cc4352394 | |
|
c6c23ddee0 | |
|
87e7f26771 | |
|
59d04f037b | |
|
4f16131a4c | |
|
f50766c477 | |
|
ce6edf4465 | |
|
d0c23802ff | |
|
80518f67e4 | |
|
96644e6a6c | |
|
94e2984c61 | |
|
5e62a75151 |
|
@ -47,6 +47,7 @@ jobs:
|
|||
uses: docker/build-push-action@v2.3.0
|
||||
with:
|
||||
context: build
|
||||
platforms: linux/amd64,linux/arm64
|
||||
file: build/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
@ -54,7 +55,7 @@ jobs:
|
|||
build-args: ${{steps.version_step.outputs.version}}
|
||||
|
||||
push_to_multi_platforms_registry:
|
||||
name: Push Docker image to Docker Hub
|
||||
name: Push Docker slim image to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Extract Version
|
||||
|
@ -87,7 +88,7 @@ jobs:
|
|||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
type=semver,pattern={{raw}}-slim
|
||||
type=pep440,pattern=v{{version}}-slim
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2.3.0
|
||||
|
|
|
@ -0,0 +1,201 @@
|
|||
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 (i) 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.
|
170
README.md
170
README.md
|
@ -6,6 +6,16 @@ This project contains a Docker image meant to facilitate the deployment of [Naco
|
|||
|
||||
[**中文**](README_ZH.md)
|
||||
|
||||
## Note
|
||||
|
||||
The following environment variables have been **removed** from the default values in the new version(**Nacos 2.2.1**)
|
||||
for the sake of **system security**, please add them yourself when starting up, otherwise an error will be reported at
|
||||
startup.
|
||||
|
||||
1. ~~NACOS_AUTH_IDENTITY_KEY~~
|
||||
2. ~~NACOS_AUTH_IDENTITY_VALUE~~
|
||||
3. ~~NACOS_AUTH_TOKEN~~
|
||||
|
||||
## Project directory
|
||||
|
||||
* build:Nacos makes the source code of the docker image
|
||||
|
@ -19,22 +29,51 @@ This project contains a Docker image meant to facilitate the deployment of [Naco
|
|||
to [Removing the Master-Slave Image Configuration](https://github.com/nacos-group/nacos-docker/wiki/%E7%A7%BB%E9%99%A4%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%BB%E4%BB%8E%E9%95%9C%E5%83%8F%E9%85%8D%E7%BD%AE)
|
||||
* Since Nacos 1.3.1 version, the database storage has been upgraded to 8.0, and it is backward compatible
|
||||
* If you use a custom database, you need to initialize
|
||||
the [database script](https://github.com/alibaba/nacos/blob/develop/distribution/conf/nacos-mysql.sql) yourself for
|
||||
the [database script](https://github.com/alibaba/nacos/blob/master/distribution/conf/mysql-schema.sql) yourself for
|
||||
the first time.
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Nacos v3.x
|
||||
|
||||
```shell
|
||||
docker run --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:2.0.2
|
||||
docker run --name nacos-standalone-derby \
|
||||
-e MODE=standalone \
|
||||
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||
-p 8080:8080 \
|
||||
-p 8848:8848 \
|
||||
-p 9848:9848 \
|
||||
-d nacos/nacos-server:latest
|
||||
```
|
||||
|
||||
### Nacos v2.x
|
||||
|
||||
```shell
|
||||
docker run --name nacos-standalone-derby-v2.5.1 \
|
||||
-e MODE=standalone \
|
||||
-e NACOS_AUTH_ENABLE=true \
|
||||
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||
-p 8848:8848 \
|
||||
-p 9848:9848 \
|
||||
-d nacos/nacos-server:v2.5.1
|
||||
```
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
* Tips: You can change the version of the Nacos image in the compose file from the following configuration.
|
||||
`example/.env`
|
||||
* Tips: You can change [the version of the Nacos image](https://hub.docker.com/r/nacos/nacos-server/tags) in the compose file from the following configuration. `example/.env`
|
||||
|
||||
```dotenv
|
||||
NACOS_VERSION=2.0.2
|
||||
NACOS_VERSION=v3.0.3
|
||||
```
|
||||
|
||||
For Mac user with Arm Chip (like M1/M2/M3 series) , you need to add `-slim` after version which support `arm` arch.
|
||||
|
||||
```dotenv
|
||||
NACOS_VERSION=v3.0.3-slim
|
||||
```
|
||||
|
||||
Run the following command:
|
||||
|
@ -46,102 +85,123 @@ Run the following command:
|
|||
cd nacos-docker
|
||||
```
|
||||
|
||||
|
||||
* Standalone Derby
|
||||
|
||||
```powershell
|
||||
docker-compose -f example/standalone-derby.yaml up
|
||||
```
|
||||
|
||||
* Standalone Mysql
|
||||
|
||||
```powershell
|
||||
# Using mysql 5.7
|
||||
docker-compose -f example/standalone-mysql-5.7.yaml up
|
||||
|
||||
# Using mysql 8
|
||||
docker-compose -f example/standalone-mysql-8.yaml up
|
||||
cd example
|
||||
./mysql-init.sh && docker-compose -f standalone-mysql.yaml up
|
||||
```
|
||||
|
||||
* Cluster
|
||||
* Standalone Independent Mysql(Only Nacos 3.x is supported)
|
||||
|
||||
```powershell
|
||||
cd example
|
||||
./mysql-init.sh && docker-compose -f standalone-independent-mysql.yaml up
|
||||
```
|
||||
|
||||
* Standalone Nacos Cluster
|
||||
|
||||
```powershell
|
||||
docker-compose -f example/cluster-hostname.yaml up
|
||||
```
|
||||
|
||||
|
||||
* Service registration
|
||||
|
||||
```powershell
|
||||
curl -X POST 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
|
||||
|
||||
curl -X POST 'http://127.0.0.1:8848/nacos/v3/client/ns/instance?serviceName=quickstart.test.service&ip=127.0.0.1&port=8080
|
||||
```
|
||||
|
||||
* Service discovery
|
||||
|
||||
```powershell
|
||||
curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'
|
||||
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/ns/instance/list?serviceName=quickstart.test.service'
|
||||
```
|
||||
|
||||
* Publish config
|
||||
|
||||
```powershell
|
||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
|
||||
curl -X POST 'http://127.0.0.1:8848/nacos/v3/auth/user/login' -d 'username=nacos' -d 'password=${your_password}'
|
||||
curl -X POST 'http://127.0.0.1:8848/nacos/v3/admin/cs/config?dataId=quickstart.test.config&groupName=test&content=HelloWorld' -H "accessToken:${your_access_token}"
|
||||
```
|
||||
|
||||
* Get config
|
||||
|
||||
```powershell
|
||||
curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"
|
||||
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/cs/config?dataId=quickstart.test.config&groupName=test'
|
||||
```
|
||||
|
||||
|
||||
* Open the Nacos console in your browser
|
||||
|
||||
link:http://127.0.0.1:8848/nacos/
|
||||
link:http://127.0.0.1:8080/index.html
|
||||
|
||||
## Common property configuration
|
||||
|
||||
| name | description | option |
|
||||
| ----------------------------- | -------------------------------------- | -------------------------------------- |
|
||||
| MODE | cluster/standalone | cluster/standalone default **cluster** |
|
||||
| NACOS_SERVERS | nacos cluster address | eg. ip1:port1 ip2:port2 ip3:port3 |
|
||||
| PREFER_HOST_MODE | Whether hostname are supported | hostname/ip default **ip** |
|
||||
| NACOS_APPLICATION_PORT | nacos server port | default **8848** |
|
||||
| NACOS_SERVER_IP | custom nacos server ip when network was mutil-network | |
|
||||
| SPRING_DATASOURCE_PLATFORM | standalone support mysql | mysql / empty default empty |
|
||||
| MYSQL_SERVICE_HOST | mysql host | |
|
||||
| MYSQL_SERVICE_PORT | mysql database port | default : **3306** |
|
||||
| MYSQL_SERVICE_DB_NAME | mysql database name | |
|
||||
| MYSQL_SERVICE_USER | username of database | |
|
||||
| MYSQL_SERVICE_PASSWORD | password of database | |
|
||||
| MYSQL_DATABASE_NUM | It indicates the number of database | default :**1** |
|
||||
| MYSQL_SERVICE_DB_PARAM | Database url parameter |default:**characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false** |
|
||||
| JVM_XMS | -Xms | default :1g |
|
||||
| JVM_XMX | -Xmx | default :1g |
|
||||
| JVM_XMN | -Xmn | default :512m |
|
||||
| JVM_MS | -XX:MetaspaceSize | default :128m |
|
||||
| JVM_MMS | -XX:MaxMetaspaceSize | default :320m |
|
||||
| NACOS_DEBUG | enable remote debug | y/n default :n |
|
||||
| TOMCAT_ACCESSLOG_ENABLED | server.tomcat.accesslog.enabled | default :false |
|
||||
| NACOS_AUTH_SYSTEM_TYPE | The auth system to use, currently only 'nacos' is supported | default :nacos |
|
||||
| NACOS_AUTH_ENABLE | If turn on auth system | default :false |
|
||||
| NACOS_AUTH_TOKEN_EXPIRE_SECONDS | The token expiration in seconds | default :18000 |
|
||||
| NACOS_AUTH_TOKEN | The default token | default :SecretKey012345678901234567890123456789012345678901234567890123456789 |
|
||||
| NACOS_AUTH_CACHE_ENABLE | Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay. | default : false |
|
||||
| MEMBER_LIST | Set the cluster list with a configuration file or command-line argument | eg:192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809 |
|
||||
| EMBEDDED_STORAGE | Use embedded storage in cluster mode without mysql | `embedded` default : none |
|
||||
| NACOS_AUTH_CACHE_ENABLE | nacos.core.auth.caching.enabled | default : false |
|
||||
| NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE | nacos.core.auth.enable.userAgentAuthWhite | default : false |
|
||||
| NACOS_AUTH_IDENTITY_KEY | nacos.core.auth.server.identity.key | default : serverIdentity |
|
||||
| NACOS_AUTH_IDENTITY_VALUE | nacos.core.auth.server.identity.value | default : security |
|
||||
| NACOS_SECURITY_IGNORE_URLS | nacos.security.ignore.urls | default : `/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**` |
|
||||
| name | description | option |
|
||||
|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| MODE | cluster/standalone | cluster/standalone default **cluster** |
|
||||
| NACOS_SERVERS | nacos cluster address | eg. ip1:port1 ip2:port2 ip3:port3 |
|
||||
| PREFER_HOST_MODE | Whether hostname are supported | hostname/ip default **ip** |
|
||||
| NACOS_APPLICATION_PORT | nacos server port | default **8848** |
|
||||
| NACOS_SERVER_IP | custom nacos server ip when network was mutil-network | |
|
||||
| SPRING_DATASOURCE_PLATFORM | standalone support mysql | mysql / empty default empty |
|
||||
| MYSQL_SERVICE_HOST | mysql host | |
|
||||
| MYSQL_SERVICE_PORT | mysql database port | default : **3306** |
|
||||
| MYSQL_SERVICE_DB_NAME | mysql database name | |
|
||||
| MYSQL_SERVICE_USER | username of database | |
|
||||
| MYSQL_SERVICE_PASSWORD | password of database | |
|
||||
| MYSQL_DATABASE_NUM | It indicates the number of database | default :**1** |
|
||||
| MYSQL_SERVICE_DB_PARAM | Database url parameter | default :**characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false** |
|
||||
| JVM_XMS | -Xms | default :1g |
|
||||
| JVM_XMX | -Xmx | default :1g |
|
||||
| JVM_XMN | -Xmn | default :512m |
|
||||
| JVM_MS | -XX:MetaspaceSize | default :128m |
|
||||
| JVM_MMS | -XX:MaxMetaspaceSize | default :320m |
|
||||
| NACOS_DEBUG | enable remote debug | y/n default :n |
|
||||
| TOMCAT_ACCESSLOG_ENABLED | server.tomcat.accesslog.enabled | default :false |
|
||||
| NACOS_AUTH_SYSTEM_TYPE | The auth system to use, currently only 'nacos' is supported | default :nacos |
|
||||
| NACOS_AUTH_ENABLE | If turn on auth system | default :false |
|
||||
| NACOS_AUTH_TOKEN_EXPIRE_SECONDS | The token expiration in seconds | default :18000 |
|
||||
| NACOS_AUTH_TOKEN | | `Note: It is removed from Nacos 2.2.1` |
|
||||
| NACOS_AUTH_CACHE_ENABLE | Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay. | default : false |
|
||||
| MEMBER_LIST | Set the cluster list with a configuration file or command-line argument | eg:192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809 |
|
||||
| EMBEDDED_STORAGE | Use embedded storage in cluster mode without mysql | `embedded` default : none |
|
||||
| NACOS_AUTH_CACHE_ENABLE | nacos.core.auth.caching.enabled | default : false |
|
||||
| NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE | nacos.core.auth.enable.userAgentAuthWhite | default : false |
|
||||
| NACOS_AUTH_IDENTITY_KEY | nacos.core.auth.server.identity.key | `Note: It is removed from Nacos 2.2.1` |
|
||||
| NACOS_AUTH_IDENTITY_VALUE | nacos.core.auth.server.identity.value | `Note: It is removed from Nacos 2.2.1` |
|
||||
| NACOS_SECURITY_IGNORE_URLS | nacos.security.ignore.urls | default : `/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**` |
|
||||
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
|
||||
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.enabled | default : `true` |
|
||||
| DB_POOL_CONNECTION_TIMEOUT | Database connection pool timeout in milliseconds | default : **30000** |
|
||||
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
|
||||
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.enabled | default : `true` |
|
||||
| NACOS_AUTH_ADMIN_ENABLE | nacos.core.auth.admin.enable | default : `true` |
|
||||
| NACOS_AUTH_CONSOLE_ENABLE | nacos.core.auth.console.enable | default : `true` | |
|
||||
| NACOS_CONSOLE_PORT | nacos.console.port | default : `8080` |
|
||||
| NACOS_CONSOLE_CONTEXTPATH | nacos.console.contextPath | default : `` |
|
||||
| NACOS_DEPLOYMENT_TYPE | nacos.deployment.type | default : `merged` support config `server` `console` |
|
||||
|
||||
~~# Advanced configuration~~
|
||||
## Advanced configuration
|
||||
|
||||
~~If the above property configuration list does not meet your requirements, you can mount the `custom.properties` file
|
||||
into the `/home/nacos/init.d/` directory of the container, where the spring properties can be configured, and the
|
||||
priority is higher than `application.properties` file~~
|
||||
|
||||
If you have a lot of custom configuration needs, It is highly recommended to mount `application.properties` in
|
||||
production environment.
|
||||
|
||||
For example:
|
||||
|
||||
```docker
|
||||
docker-compose -f example/custom-application-config.yaml up -d
|
||||
```
|
||||
|
||||
## Nacos + Grafana + Prometheus
|
||||
|
||||
Usage reference:[Nacos monitor-guide](https://nacos.io/zh-cn/docs/monitor-guide.html)
|
||||
|
|
215
README_ZH.md
215
README_ZH.md
|
@ -1,7 +1,19 @@
|
|||
# Nacos Docker
|
||||
|
||||

|
||||
|
||||
本项目是 [Nacos](https://github.com/alibaba/nacos) Server的docker镜像的build源码,以及Nacos server 在docker的单机和集群的运行例子.
|
||||
|
||||
[**English**](README.md)
|
||||
|
||||
## 注意
|
||||
|
||||
从Nacos 2.2.1开始为了系统安全考虑**移除**了以下环境变量的默认值,启动时请自行添加,否则会启动报错.
|
||||
|
||||
1. ~~NACOS_AUTH_IDENTITY_KEY~~
|
||||
2. ~~NACOS_AUTH_IDENTITY_VALUE~~
|
||||
3. ~~NACOS_AUTH_TOKEN~~
|
||||
|
||||
## 项目目录
|
||||
|
||||
* build:nacos 镜像制作的源码
|
||||
|
@ -18,11 +30,52 @@
|
|||
镜像以后,移除了数据库主从镜像,具体原因请参考[移除主从镜像配置](https://github.com/nacos-group/nacos-docker/wiki/%E7%A7%BB%E9%99%A4%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%BB%E4%BB%8E%E9%95%9C%E5%83%8F%E9%85%8D%E7%BD%AE)
|
||||
* 从Nacos 1.3.1版本开始,数据库存储已经升级到8.0, 并且它向下兼容
|
||||
* 例子演示中使用的数据库是为了方便定制了官方Mysql镜像, 自动初始化的数据库脚本.
|
||||
* 如果你使用自定义数据库,
|
||||
第一次启动Nacos前需要手动初始化 [数据库脚本](https://github.com/alibaba/nacos/blob/develop/distribution/conf/nacos-mysql.sql) .
|
||||
* 如果你使用自定义数据库, 第一次启动Nacos前需要手动初始化 [数据库脚本](https://github.com/alibaba/nacos/blob/master/distribution/conf/mysql-schema.sql)
|
||||
|
||||
## 快速开始
|
||||
|
||||
### Nacos v3.x
|
||||
|
||||
```shell
|
||||
docker run --name nacos-standalone-derby \
|
||||
-e MODE=standalone \
|
||||
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||
-p 8080:8080 \
|
||||
-p 8848:8848 \
|
||||
-p 9848:9848 \
|
||||
-d nacos/nacos-server:latest
|
||||
```
|
||||
|
||||
### Nacos v2.x
|
||||
|
||||
```shell
|
||||
docker run --name nacos-standalone-derby-v2.5.1 \
|
||||
-e MODE=standalone \
|
||||
-e NACOS_AUTH_ENABLE=true \
|
||||
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||
-p 8848:8848 \
|
||||
-p 9848:9848 \
|
||||
-d nacos/nacos-server:v2.5.1
|
||||
```
|
||||
|
||||
## 其他使用方式
|
||||
|
||||
* 提示: 你需要通过 `example/.env` 中的以下配置来更改 Compose 文件中 [Nacos 镜像版本](https://hub.docker.com/r/nacos/nacos-server/tags)。
|
||||
|
||||
```dotenv
|
||||
NACOS_VERSION=v3.0.3
|
||||
```
|
||||
|
||||
对于使用 Arm 芯片(如 M1/M2/M3 系列)的 Mac 用户,需要在支持 `arm` arch 的版本后添加 `-slim`。
|
||||
|
||||
```dotenv
|
||||
NACOS_VERSION=v3.0.3-slim
|
||||
```
|
||||
|
||||
打开命令窗口执行:
|
||||
|
||||
* Clone project
|
||||
|
@ -32,7 +85,6 @@
|
|||
cd nacos-docker
|
||||
```
|
||||
|
||||
|
||||
* Standalone Derby
|
||||
|
||||
```powershell
|
||||
|
@ -42,131 +94,110 @@
|
|||
* Standalone Mysql
|
||||
|
||||
```powershell
|
||||
# Using mysql 5.7
|
||||
docker-compose -f example/standalone-mysql-5.7.yaml up
|
||||
cd example
|
||||
./mysql-init.sh && docker-compose -f standalone-mysql.yaml up
|
||||
```
|
||||
* Standalone Independent Mysql(仅支持 Nacos 3.x 版本)
|
||||
|
||||
# Using mysql 8
|
||||
docker-compose -f example/standalone-mysql-8.yaml up
|
||||
```powershell
|
||||
cd example
|
||||
./mysql-init.sh && docker-compose -f standalone-independent-mysql.yaml up
|
||||
```
|
||||
|
||||
* 集群模式
|
||||
* docker单节点部署集群模式
|
||||
|
||||
```powershell
|
||||
docker-compose -f example/cluster-hostname.yaml up
|
||||
```
|
||||
|
||||
|
||||
* 服务注册示例
|
||||
|
||||
```powershell
|
||||
curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
|
||||
curl -X POST 'http://127.0.0.1:8848/nacos/v3/client/ns/instance?serviceName=quickstart.test.service&ip=127.0.0.1&port=8080
|
||||
```
|
||||
|
||||
* 服务发现示例
|
||||
|
||||
```powershell
|
||||
curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'
|
||||
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/ns/instance/list?serviceName=quickstart.test.service'
|
||||
```
|
||||
|
||||
* 推送配置示例
|
||||
|
||||
```powershell
|
||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
|
||||
curl -X POST 'http://127.0.0.1:8848/nacos/v3/auth/user/login' -d 'username=nacos' -d 'password=${your_password}'
|
||||
curl -X POST 'http://127.0.0.1:8848/nacos/v3/admin/cs/config?dataId=quickstart.test.config&groupName=test&content=HelloWorld' -H "accessToken:${your_access_token}"
|
||||
```
|
||||
|
||||
* 获取配置示例
|
||||
|
||||
```powershell
|
||||
curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"
|
||||
```
|
||||
|
||||
|
||||
* 打开浏览器
|
||||
|
||||
link:http://127.0.0.1:8848/nacos/
|
||||
|
||||
## 其他使用方式
|
||||
|
||||
打开命令窗口执行:
|
||||
|
||||
* Clone 项目 并且进入项目根目录
|
||||
|
||||
```powershell
|
||||
git clone https://github.com/paderlol/nacos-docker.git
|
||||
cd nacos-docker
|
||||
```
|
||||
|
||||
|
||||
* 单机
|
||||
|
||||
```powershell
|
||||
docker-compose -f standalone.yaml up
|
||||
```
|
||||
|
||||
* 集群
|
||||
|
||||
```powershell
|
||||
docker-compose -f cluster.yaml up
|
||||
```
|
||||
|
||||
|
||||
* 注册服务
|
||||
|
||||
```powershell
|
||||
curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
|
||||
```
|
||||
|
||||
* 注册配置
|
||||
|
||||
```powershell
|
||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
|
||||
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/cs/config?dataId=quickstart.test.config&groupName=test'
|
||||
```
|
||||
|
||||
* 访问控制台
|
||||
|
||||
浏览器访问:http://127.0.0.1:8848/nacos/
|
||||
浏览器访问:http://127.0.0.1:8080/index.html
|
||||
|
||||
## 属性配置列表
|
||||
| 属性名称 | 描述 | 选项 |
|
||||
| --------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------ |
|
||||
| MODE | 系统启动方式: 集群/单机 | cluster/standalone 默认 **cluster** |
|
||||
| NACOS_SERVERS | 集群地址 | p1:port1空格ip2:port2 空格ip3:port3 |
|
||||
| PREFER_HOST_MODE | 支持IP还是域名模式 | hostname/ip 默认**IP** |
|
||||
| NACOS_SERVER_PORT | Nacos 运行端口 | 默认**8848** |
|
||||
| NACOS_SERVER_IP | 多网卡模式下可以指定IP | |
|
||||
| SPRING_DATASOURCE_PLATFORM | 单机模式下支持MYSQL数据库 | mysql / 空 默认:空 |
|
||||
| MYSQL_SERVICE_HOST | 数据库 连接地址 | |
|
||||
| MYSQL_SERVICE_PORT | 数据库端口 | 默认 : **3306** |
|
||||
| MYSQL_SERVICE_DB_NAME | 数据库库名 | |
|
||||
| MYSQL_SERVICE_USER | 数据库用户名 | |
|
||||
| MYSQL_SERVICE_PASSWORD | 数据库用户密码 | |
|
||||
| MYSQL_SERVICE_DB_PARAM | 数据库连接参数 | 默认:**characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false** |
|
||||
| MYSQL_DATABASE_NUM | 数据库个数 | 默认:**1** |
|
||||
| JVM_XMS | -Xms | 默认 :1g |
|
||||
| JVM_XMX | -Xmx | 默认 :1g |
|
||||
| JVM_XMN | -Xmn | 512m |
|
||||
| JVM_MS | - XX:MetaspaceSize | 默认 :128m |
|
||||
| JVM_MMS | -XX:MaxMetaspaceSize | 默认 :320m |
|
||||
| NACOS_DEBUG | 是否开启远程DEBUG | y/n 默认 :n |
|
||||
| TOMCAT_ACCESSLOG_ENABLED | server.tomcat.accesslog.enabled | 默认 :false |
|
||||
| NACOS_AUTH_SYSTEM_TYPE | 权限系统类型选择,目前只支持nacos类型 | 默认 :nacos |
|
||||
| NACOS_AUTH_ENABLE | 是否开启权限系统 | 默认 :false |
|
||||
| NACOS_AUTH_TOKEN_EXPIRE_SECONDS | token 失效时间 | 默认 :18000 |
|
||||
| NACOS_AUTH_TOKEN | token | 默认 :SecretKey012345678901234567890123456789012345678901234567890123456789 |
|
||||
| NACOS_AUTH_CACHE_ENABLE | 权限缓存开关 ,开启后权限缓存的更新默认有15秒的延迟 | 默认 : false |
|
||||
| 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 |
|
||||
| EMBEDDED_STORAGE | 是否开启集群嵌入式存储模式 | `embedded` 默认 : none |
|
||||
| NACOS_AUTH_CACHE_ENABLE | nacos.core.auth.caching.enabled | default : false |
|
||||
| NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE | nacos.core.auth.enable.userAgentAuthWhite | default : false |
|
||||
| NACOS_AUTH_IDENTITY_KEY | nacos.core.auth.server.identity.key | default : serverIdentity |
|
||||
| NACOS_AUTH_IDENTITY_VALUE | nacos.core.auth.server.identity.value | default : security |
|
||||
| NACOS_SECURITY_IGNORE_URLS | nacos.security.ignore.urls | default : `/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**` |
|
||||
|
||||
~~## 高级配置~~
|
||||
| 属性名称 | 描述 | 选项 |
|
||||
|-----------------------------------------|-------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| MODE | 系统启动方式: 集群/单机 | cluster/standalone 默认 **cluster** |
|
||||
| NACOS_SERVERS | 集群地址 | p1:port1空格ip2:port2 空格ip3:port3 |
|
||||
| PREFER_HOST_MODE | 支持IP还是域名模式 | hostname/ip 默认**IP** |
|
||||
| NACOS_SERVER_PORT | Nacos 运行端口 | 默认**8848** |
|
||||
| NACOS_SERVER_IP | 多网卡模式下可以指定IP | |
|
||||
| SPRING_DATASOURCE_PLATFORM | 单机模式下支持MYSQL数据库 | mysql / 空 默认:空 |
|
||||
| MYSQL_SERVICE_HOST | 数据库 连接地址 | |
|
||||
| MYSQL_SERVICE_PORT | 数据库端口 | 默认 : **3306** |
|
||||
| MYSQL_SERVICE_DB_NAME | 数据库库名 | |
|
||||
| MYSQL_SERVICE_USER | 数据库用户名 | |
|
||||
| MYSQL_SERVICE_PASSWORD | 数据库用户密码 | |
|
||||
| MYSQL_SERVICE_DB_PARAM | 数据库连接参数 | 默认:**characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false** |
|
||||
| MYSQL_DATABASE_NUM | 数据库个数 | 默认:**1** |
|
||||
| JVM_XMS | -Xms | 默认 :1g |
|
||||
| JVM_XMX | -Xmx | 默认 :1g |
|
||||
| JVM_XMN | -Xmn | 512m |
|
||||
| JVM_MS | - XX:MetaspaceSize | 默认 :128m |
|
||||
| JVM_MMS | -XX:MaxMetaspaceSize | 默认 :320m |
|
||||
| NACOS_DEBUG | 是否开启远程DEBUG | y/n 默认 :n |
|
||||
| TOMCAT_ACCESSLOG_ENABLED | server.tomcat.accesslog.enabled | 默认 :false |
|
||||
| NACOS_AUTH_SYSTEM_TYPE | 权限系统类型选择,目前只支持nacos类型 | 默认 :nacos |
|
||||
| NACOS_AUTH_ENABLE | 是否开启权限系统 | 默认 :false |
|
||||
| NACOS_AUTH_TOKEN_EXPIRE_SECONDS | token 失效时间 | 默认 :18000 |
|
||||
| NACOS_AUTH_TOKEN | token | `注意:该环境变量在Nacos 2.2.1版本中已移除` |
|
||||
| NACOS_AUTH_CACHE_ENABLE | 权限缓存开关 ,开启后权限缓存的更新默认有15秒的延迟 | 默认 : false |
|
||||
| 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 |
|
||||
| EMBEDDED_STORAGE | 是否开启集群嵌入式存储模式 | `embedded` 默认 : none |
|
||||
| NACOS_AUTH_CACHE_ENABLE | nacos.core.auth.caching.enabled | default : false |
|
||||
| NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE | nacos.core.auth.enable.userAgentAuthWhite | default : false |
|
||||
| NACOS_AUTH_IDENTITY_KEY | nacos.core.auth.server.identity.key | `注意:该环境变量在Nacos 2.2.1版本中已移除` |
|
||||
| NACOS_AUTH_IDENTITY_VALUE | nacos.core.auth.server.identity.value | `注意:该环境变量在Nacos 2.2.1版本中已移除` |
|
||||
| NACOS_SECURITY_IGNORE_URLS | nacos.security.ignore.urls | default : `/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**` |
|
||||
| DB_POOL_CONNECTION_TIMEOUT | 数据库连接池超时时间,单位为毫秒 | 默认 : **30000** |
|
||||
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
|
||||
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.enabled | default : `true` |
|
||||
| NACOS_AUTH_ADMIN_ENABLE | nacos.core.auth.admin.enable | default : `true` |
|
||||
| NACOS_AUTH_CONSOLE_ENABLE | nacos.core.auth.console.enable | default : `true` | |
|
||||
| NACOS_CONSOLE_PORT | nacos.console.port | default : `8080` |
|
||||
| NACOS_CONSOLE_CONTEXTPATH | nacos.console.contextPath | default : `` |
|
||||
| NACOS_DEPLOYMENT_TYPE | nacos.deployment.type | default : `merged` 支持配置 `server` `console` |
|
||||
|
||||
~~如果上面的属性列表无法满足你的需求时,可以挂载`custom.properties`到`/home/nacos/init.d/` 目录,然后在里面像使用Spring Boot的`application.properties`
|
||||
## 高级配置
|
||||
|
||||
~~如果上面的属性列表无法满足你的需求时,可以挂载`custom.properties`到`/home/nacos/init.d/` 目录,然后在里面像使用Spring
|
||||
Boot的`application.properties`
|
||||
文件一样配置属性, 并且这个文件配置的属性**优先级高于application.properties**~~
|
||||
|
||||
如果你有很多自定义配置的需求,强烈建议在生产环境对application.properties文件进行挂卷定义.
|
||||
|
||||
举个例子:
|
||||
|
||||
```docker
|
||||
docker run --name nacos-standalone -e MODE=standalone -v /path/application.properties:/home/nacos/conf/application.properties -p 8848:8848 -d -p 9848:9848 nacos/nacos-server:2.1.1
|
||||
```
|
||||
|
||||
## Nacos + Grafana + Prometheus
|
||||
|
||||
使用参考:[Nacos monitor-guide](https://nacos.io/zh-cn/docs/monitor-guide.html)
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
FROM centos:7.9.2009
|
||||
MAINTAINER pader "huangmnlove@163.com"
|
||||
FROM alpine:latest
|
||||
LABEL maintainer="pader <huangmnlove@163.com>"
|
||||
|
||||
# set environment
|
||||
# 安装依赖
|
||||
RUN apk add --no-cache openjdk17-jre curl iputils ncurses vim libcurl bash libstdc++
|
||||
|
||||
# 设置环境变量
|
||||
ENV MODE="cluster" \
|
||||
PREFER_HOST_MODE="ip"\
|
||||
BASE_DIR="/home/nacos" \
|
||||
CLASSPATH=".:/home/nacos/conf:$CLASSPATH" \
|
||||
CLUSTER_CONF="/home/nacos/conf/cluster.conf" \
|
||||
FUNCTION_MODE="all" \
|
||||
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk" \
|
||||
JAVA_HOME="/usr/lib/jvm/java-17-openjdk" \
|
||||
NACOS_USER="nacos" \
|
||||
JAVA="/usr/lib/jvm/java-1.8.0-openjdk/bin/java" \
|
||||
JAVA="/usr/lib/jvm/java-17-openjdk/bin/java" \
|
||||
JVM_XMS="1g" \
|
||||
JVM_XMX="1g" \
|
||||
JVM_XMN="512m" \
|
||||
|
@ -20,35 +23,28 @@ ENV MODE="cluster" \
|
|||
TOMCAT_ACCESSLOG_ENABLED="false" \
|
||||
TIME_ZONE="Asia/Shanghai"
|
||||
|
||||
ARG NACOS_VERSION=2.1.0-BETA
|
||||
ARG NACOS_VERSION=3.0.3
|
||||
ARG HOT_FIX_FLAG=""
|
||||
|
||||
WORKDIR $BASE_DIR
|
||||
|
||||
# 下载并安装 Nacos
|
||||
RUN set -x \
|
||||
&& yum update -y \
|
||||
&& yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel wget iputils nc vim libcurl
|
||||
RUN wget https://github.com/alibaba/nacos/releases/download/${NACOS_VERSION}${HOT_FIX_FLAG}/nacos-server-${NACOS_VERSION}.tar.gz -P /home
|
||||
RUN tar -xzvf /home/nacos-server-${NACOS_VERSION}.tar.gz -C /home \
|
||||
&& rm -rf /home/nacos-server-${NACOS_VERSION}.tar.gz /home/nacos/bin/* /home/nacos/conf/*.properties /home/nacos/conf/*.example /home/nacos/conf/nacos-mysql.sql
|
||||
RUN yum autoremove -y wget \
|
||||
&& ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone \
|
||||
&& yum clean all
|
||||
|
||||
|
||||
|
||||
&& curl -SL "https://github.com/alibaba/nacos/releases/download/${NACOS_VERSION}${HOT_FIX_FLAG}/nacos-server-${NACOS_VERSION}.tar.gz" -o nacos-server.tar.gz \
|
||||
&& tar -xzvf nacos-server.tar.gz -C /home \
|
||||
&& rm -rf nacos-server.tar.gz /home/nacos/bin/* /home/nacos/conf/*.properties /home/nacos/conf/*.example /home/nacos/conf/nacos-mysql.sql \
|
||||
&& ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone
|
||||
|
||||
ADD bin/docker-startup.sh bin/docker-startup.sh
|
||||
ADD conf/application.properties conf/application.properties
|
||||
|
||||
|
||||
# set startup log dir
|
||||
# 设置启动日志目录
|
||||
RUN mkdir -p logs \
|
||||
&& cd logs \
|
||||
&& touch start.out \
|
||||
&& ln -sf /dev/stdout start.out \
|
||||
&& ln -sf /dev/stderr start.out
|
||||
RUN chmod +x bin/docker-startup.sh
|
||||
&& touch logs/start.out \
|
||||
&& ln -sf /dev/stdout logs/start.out \
|
||||
&& ln -sf /dev/stderr logs/start.out \
|
||||
&& chmod +x bin/docker-startup.sh
|
||||
|
||||
EXPOSE 8848
|
||||
ENTRYPOINT ["bin/docker-startup.sh"]
|
||||
EXPOSE 9848 8080
|
||||
ENTRYPOINT ["sh","bin/docker-startup.sh"]
|
|
@ -1,6 +1,6 @@
|
|||
FROM amd64/buildpack-deps:buster-curl as installer
|
||||
|
||||
ARG NACOS_VERSION=2.1.0-BETA
|
||||
ARG NACOS_VERSION=3.0.3
|
||||
ARG HOT_FIX_FLAG=""
|
||||
|
||||
RUN set -x \
|
||||
|
@ -8,7 +8,7 @@ RUN set -x \
|
|||
&& tar -xzvf /var/tmp/nacos-server.tar.gz -C /home \
|
||||
&& rm -rf /var/tmp/nacos-server.tar.gz /home/nacos/bin/* /home/nacos/conf/*.properties /home/nacos/conf/*.example /home/nacos/conf/nacos-mysql.sql
|
||||
|
||||
FROM openjdk:8-jre-slim
|
||||
FROM eclipse-temurin:17.0.15_6-jre
|
||||
|
||||
# set environment
|
||||
ENV MODE="cluster" \
|
||||
|
@ -18,7 +18,7 @@ ENV MODE="cluster" \
|
|||
CLUSTER_CONF="/home/nacos/conf/cluster.conf" \
|
||||
FUNCTION_MODE="all" \
|
||||
NACOS_USER="nacos" \
|
||||
JAVA="/usr/local/openjdk-8/bin/java" \
|
||||
JAVA="/opt/java/openjdk/bin/java" \
|
||||
JVM_XMS="1g" \
|
||||
JVM_XMX="1g" \
|
||||
JVM_XMN="512m" \
|
||||
|
@ -45,4 +45,5 @@ RUN mkdir -p logs \
|
|||
RUN chmod +x bin/docker-startup.sh
|
||||
|
||||
EXPOSE 8848
|
||||
EXPOSE 9848 8080
|
||||
ENTRYPOINT ["bin/docker-startup.sh"]
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set -x
|
||||
export CUSTOM_SEARCH_NAMES="application,custom"
|
||||
export CUSTOM_SEARCH_LOCATIONS=${BASE_DIR}/init.d/,file:${BASE_DIR}/conf/
|
||||
export MEMBER_LIST=""
|
||||
export CUSTOM_SEARCH_NAMES="application"
|
||||
export CUSTOM_SEARCH_LOCATIONS=file:${BASE_DIR}/conf/
|
||||
export MEMBER_LIST="$MEMBER_LIST"
|
||||
PLUGINS_DIR="/home/nacos/plugins/peer-finder"
|
||||
function print_servers() {
|
||||
if [[ ! -d "${PLUGINS_DIR}" ]]; then
|
||||
if [[ ! -d "${PLUGINS_DIR}" ]]; then
|
||||
echo "" >"$CLUSTER_CONF"
|
||||
for server in ${NACOS_SERVERS}; do
|
||||
echo "$server" >>"$CLUSTER_CONF"
|
||||
|
@ -27,18 +27,32 @@ function print_servers() {
|
|||
sleep 30
|
||||
fi
|
||||
}
|
||||
|
||||
function join_if_exist() {
|
||||
if [ -n "$2" ]; then
|
||||
echo "$1$2"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
#===========================================================================================
|
||||
# JVM Configuration
|
||||
#===========================================================================================
|
||||
if [[ "${MODE}" == "standalone" ]]; then
|
||||
Xms=$(join_if_exist "-Xms" ${JVM_XMS})
|
||||
Xmx=$(join_if_exist "-Xmx" ${JVM_XMX})
|
||||
Xmn=$(join_if_exist "-Xmn" ${JVM_XMN})
|
||||
XX_MS=$(join_if_exist "-XX:MetaspaceSize=" ${JVM_MS})
|
||||
XX_MMS=$(join_if_exist "-XX:MaxMetaspaceSize=" ${JVM_MMS})
|
||||
|
||||
JAVA_OPT="${JAVA_OPT} -Xms${JVM_XMS} -Xmx${JVM_XMX} -Xmn${JVM_XMN}"
|
||||
if [[ "${MODE}" == "standalone" ]]; then
|
||||
JAVA_OPT="${JAVA_OPT} $Xms $Xmx $Xmn"
|
||||
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 -Xms${JVM_XMS} -Xmx${JVM_XMX} -Xmn${JVM_XMN} -XX:MetaspaceSize=${JVM_MS} -XX:MaxMetaspaceSize=${JVM_MMS}"
|
||||
JAVA_OPT="${JAVA_OPT} -server $Xms $Xmx $Xmn $XX_MS $XX_MMS"
|
||||
if [[ "${NACOS_DEBUG}" == "y" ]]; then
|
||||
JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n"
|
||||
fi
|
||||
|
@ -78,27 +92,55 @@ if [[ ! -z "${NACOS_AUTH_ENABLE}" ]]; then
|
|||
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.enabled=${NACOS_AUTH_ENABLE}"
|
||||
fi
|
||||
|
||||
if [[ ! -z "${NACOS_AUTH_ADMIN_ENABLE}" ]]; then
|
||||
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.admin.enabled=${NACOS_AUTH_ADMIN_ENABLE}"
|
||||
fi
|
||||
|
||||
if [[ ! -z "${NACOS_AUTH_CONSOLE_ENABLE}" ]]; then
|
||||
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.console.enabled=${NACOS_AUTH_CONSOLE_ENABLE}"
|
||||
fi
|
||||
|
||||
if [[ -z "${NACOS_AUTH_TOKEN}" ]]; then
|
||||
echo "env NACOS_AUTH_TOKEN must be set with Base64 String."
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [[ -z "${NACOS_AUTH_IDENTITY_KEY}" ]]; then
|
||||
echo "env NACOS_AUTH_IDENTITY_KEY must be set."
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [[ -z "${NACOS_AUTH_IDENTITY_VALUE}" ]]; then
|
||||
echo "env NACOS_AUTH_IDENTITY_VALUE must be set."
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [[ "${PREFER_HOST_MODE}" == "hostname" ]]; then
|
||||
JAVA_OPT="${JAVA_OPT} -Dnacos.preferHostnameOverIp=true"
|
||||
fi
|
||||
JAVA_OPT="${JAVA_OPT} -Dnacos.member.list=${MEMBER_LIST}"
|
||||
|
||||
if [[ ! -z "${NACOS_DEPLOYMENT_TYPE}" ]]; then
|
||||
JAVA_OPT="${JAVA_OPT} -Dnacos.deployment.type=${NACOS_DEPLOYMENT_TYPE}"
|
||||
fi
|
||||
|
||||
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} -cp .:${BASE_DIR}/plugins/cmdb/*.jar:${BASE_DIR}/plugins/mysql/*.jar"
|
||||
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:${BASE_DIR}/plugins/health:${BASE_DIR}/plugins/cmdb:${BASE_DIR}/plugins/mysql"
|
||||
JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 "
|
||||
JAVA_OPT_EXT_FIX="-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,${BASE_DIR}/plugins/health,${BASE_DIR}/plugins/cmdb,${BASE_DIR}/plugins/selector"
|
||||
JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"
|
||||
JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/nacos-server.jar"
|
||||
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
|
||||
JAVA_OPT="${JAVA_OPT} --spring.config.additional-location=${CUSTOM_SEARCH_LOCATIONS}"
|
||||
JAVA_OPT="${JAVA_OPT} --spring.config.name=${CUSTOM_SEARCH_NAMES}"
|
||||
JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml"
|
||||
JAVA_OPT="${JAVA_OPT} --server.max-http-header-size=524288"
|
||||
JAVA_OPT="${JAVA_OPT} --server.max-http-request-header-size=524288"
|
||||
|
||||
echo "Nacos is starting, you can docker logs your container"
|
||||
exec $JAVA ${JAVA_OPT}
|
||||
|
|
|
@ -1,49 +1,305 @@
|
|||
# spring
|
||||
server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}
|
||||
server.contextPath=/nacos
|
||||
server.port=${NACOS_APPLICATION_PORT:8848}
|
||||
spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:""}
|
||||
nacos.cmdb.dumpTaskInterval=3600
|
||||
nacos.cmdb.eventTaskInterval=10
|
||||
nacos.cmdb.labelTaskInterval=300
|
||||
nacos.cmdb.loadDataAtStart=false
|
||||
#
|
||||
# Copyright 1999-2025 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 Common Configurations ---------------#
|
||||
|
||||
#*************** Nacos port Related Configurations ***************#
|
||||
### Nacos Server Main port
|
||||
nacos.server.main.port=${NACOS_APPLICATION_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=
|
||||
|
||||
#*************** Datasource Related Configurations ***************#
|
||||
### nacos.plugin.datasource.log.enabled=true
|
||||
spring.sql.init.platform=${SPRING_DATASOURCE_PLATFORM:}
|
||||
### Count of DB:
|
||||
# db.num=1
|
||||
|
||||
### Connect URL of DB:
|
||||
db.num=${MYSQL_DATABASE_NUM:1}
|
||||
db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?${MYSQL_SERVICE_DB_PARAM:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false}
|
||||
db.url.1=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?${MYSQL_SERVICE_DB_PARAM:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false}
|
||||
db.user=${MYSQL_SERVICE_USER}
|
||||
db.password=${MYSQL_SERVICE_PASSWORD}
|
||||
### The auth system to use, currently only 'nacos' is supported:
|
||||
db.user.0=${MYSQL_SERVICE_USER}
|
||||
db.password.0=${MYSQL_SERVICE_PASSWORD}
|
||||
|
||||
db.pool.config.connectionTimeout=${DB_POOL_CONNECTION_TIMEOUT:30000}
|
||||
db.pool.config.validationTimeout=10000
|
||||
db.pool.config.maximumPoolSize=20
|
||||
db.pool.config.minimumIdle=2
|
||||
|
||||
#*************** Metrics Related Configurations ***************#
|
||||
### Metrics for prometheus
|
||||
management.endpoints.web.exposure.include=prometheus
|
||||
|
||||
### 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
|
||||
|
||||
#*************** 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
|
||||
### enable to support prometheus service discovery
|
||||
#nacos.prometheus.metrics.enabled=true
|
||||
|
||||
#*************** Distro Related Configurations ***************#
|
||||
|
||||
### Distro data sync delay time, when sync task delayed, task will be merged for same data key. Default 1 second.
|
||||
# nacos.core.protocol.distro.data.sync.delayMs=1000
|
||||
### Distro data sync timeout for one sync data, default 3 seconds.
|
||||
# nacos.core.protocol.distro.data.sync.timeoutMs=3000
|
||||
### Distro data sync retry delay time when sync data failed or timeout, same behavior with delayMs, default 3 seconds.
|
||||
# nacos.core.protocol.distro.data.sync.retryDelayMs=3000
|
||||
### Distro data verify interval time, verify synced data whether expired for a interval. Default 5 seconds.
|
||||
# nacos.core.protocol.distro.data.verify.intervalMs=5000
|
||||
### Distro data verify timeout for one verify, default 3 seconds.
|
||||
# nacos.core.protocol.distro.data.verify.timeoutMs=3000
|
||||
### Distro data load retry delay when load snapshot data failed, default 30 seconds.
|
||||
# nacos.core.protocol.distro.data.load.retryDelayMs=30000
|
||||
### enable to support prometheus service discovery
|
||||
#nacos.prometheus.metrics.enabled=true
|
||||
|
||||
#*************** Grpc Configurations ***************#
|
||||
|
||||
### Sets the maximum message size allowed to be received on the server.
|
||||
#nacos.remote.server.grpc.sdk.max-inbound-message-size=10485760
|
||||
### Sets the time(milliseconds) without read activity before sending a keepalive ping. The typical default is two hours.
|
||||
#nacos.remote.server.grpc.sdk.keep-alive-time=7200000
|
||||
### Sets a time(milliseconds) waiting for read activity after sending a keepalive ping. Defaults to 20 seconds.
|
||||
#nacos.remote.server.grpc.sdk.keep-alive-timeout=20000
|
||||
### Sets a time(milliseconds) that specify the most aggressive keep-alive time clients are permitted to configure. The typical default is 5 minutes
|
||||
#nacos.remote.server.grpc.sdk.permit-keep-alive-time=300000
|
||||
### cluster grpc(inside the nacos server) configuration
|
||||
#nacos.remote.server.grpc.cluster.max-inbound-message-size=10485760
|
||||
### Sets the time(milliseconds) without read activity before sending a keepalive ping. The typical default is two hours.
|
||||
#nacos.remote.server.grpc.cluster.keep-alive-time=7200000
|
||||
### Sets a time(milliseconds) waiting for read activity after sending a keepalive ping. Defaults to 20 seconds.
|
||||
#nacos.remote.server.grpc.cluster.keep-alive-timeout=20000
|
||||
### Sets a time(milliseconds) that specify the most aggressive keep-alive time clients are permitted to configure. The typical default is 5 minutes
|
||||
#nacos.remote.server.grpc.cluster.permit-keep-alive-time=300000
|
||||
|
||||
#*************** Config Module Related Configurations ***************#
|
||||
|
||||
### the maximum retry times for push
|
||||
nacos.config.push.maxRetryTime=50
|
||||
|
||||
#*************** Naming Module Related Configurations ***************#
|
||||
### Data dispatch task execution period in milliseconds:
|
||||
|
||||
### 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
|
||||
|
||||
#--------------- Nacos Web Server Configurations ---------------#
|
||||
|
||||
#*************** Nacos Web Server Related Configurations ***************#
|
||||
### Nacos Server Web context path:
|
||||
nacos.server.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}
|
||||
|
||||
#*************** Access Log Related Configurations ***************#
|
||||
### If turn on the access log:
|
||||
server.tomcat.accesslog.enabled=true
|
||||
|
||||
### accesslog automatic cleaning time
|
||||
server.tomcat.accesslog.max-days=30
|
||||
|
||||
### 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:.
|
||||
|
||||
#*************** API Related Configurations ***************#
|
||||
### Include message field
|
||||
server.error.include-message=ALWAYS
|
||||
|
||||
### Enabled for open API compatibility
|
||||
# nacos.core.api.compatibility.client.enabled=true
|
||||
### Enabled for admin API compatibility
|
||||
# nacos.core.api.compatibility.admin.enabled=false
|
||||
### Enabled for console API compatibility
|
||||
# nacos.core.api.compatibility.console.enabled=false
|
||||
|
||||
#--------------- Nacos Console Configurations ---------------#
|
||||
|
||||
#*************** Nacos Console Related Configurations ***************#
|
||||
### Nacos Console Main port
|
||||
nacos.console.port=${NACOS_CONSOLE_PORT:8080}
|
||||
### Nacos Server Web context path:
|
||||
nacos.console.contextPath=${NACOS_CONSOLE_CONTEXTPATH:}
|
||||
|
||||
### Nacos Server context path, which link to nacos server `nacos.server.contextPath`, works when deployment type is `console`
|
||||
nacos.console.remote.server.context-path=${SERVER_SERVLET_CONTEXTPATH:/nacos}
|
||||
|
||||
#************** Console UI Configuration ***************#
|
||||
|
||||
### Turn on/off the nacos console ui.
|
||||
nacos.console.ui.enabled=true
|
||||
|
||||
#--------------- Nacos Plugin Configurations ---------------#
|
||||
|
||||
#*************** CMDB Plugin 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
|
||||
|
||||
#*************** Auth Plugin Related Configurations ***************#
|
||||
### The ignore urls of auth, will be deprecated in the future:
|
||||
nacos.security.ignore.urls=${NACOS_SECURITY_IGNORE_URLS:/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**}
|
||||
|
||||
### The auth system to use, default 'nacos' and 'ldap' is supported, other type should be implemented by yourself:
|
||||
nacos.core.auth.system.type=${NACOS_AUTH_SYSTEM_TYPE:nacos}
|
||||
|
||||
|
||||
### The token expiration in seconds:
|
||||
nacos.core.auth.default.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000}
|
||||
|
||||
### The default token:
|
||||
nacos.core.auth.default.token.secret.key=${NACOS_AUTH_TOKEN:SecretKey012345678901234567890123456789012345678901234567890123456789}
|
||||
### If turn on auth system:
|
||||
# Whether open nacos server API auth system
|
||||
nacos.core.auth.enabled=false
|
||||
# Whether open nacos admin API auth system
|
||||
nacos.core.auth.admin.enabled=true
|
||||
# Whether open nacos console API auth system
|
||||
nacos.core.auth.console.enabled=true
|
||||
|
||||
### 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=${NACOS_AUTH_CACHE_ENABLE:false}
|
||||
nacos.core.auth.enable.userAgentAuthWhite=${NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE:false}
|
||||
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity}
|
||||
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_VALUE:security}
|
||||
server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false}
|
||||
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D
|
||||
# default current work dir
|
||||
server.tomcat.basedir=
|
||||
## spring security config
|
||||
### turn off security
|
||||
nacos.security.ignore.urls=${NACOS_SECURITY_IGNORE_URLS:/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**}
|
||||
# metrics for elastic search
|
||||
management.metrics.export.elastic.enabled=false
|
||||
management.metrics.export.influx.enabled=false
|
||||
|
||||
nacos.naming.distro.taskDispatchThreadCount=10
|
||||
nacos.naming.distro.taskDispatchPeriod=200
|
||||
nacos.naming.distro.batchSyncKeyCount=1000
|
||||
nacos.naming.distro.initDataRatio=0.9
|
||||
nacos.naming.distro.syncRetryDelay=5000
|
||||
nacos.naming.data.warmup=true
|
||||
### worked when nacos.core.auth.enabled=true
|
||||
### 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_AUTH_IDENTITY_KEY:}
|
||||
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_VALUE:}
|
||||
|
||||
### worked when nacos.core.auth.system.type=nacos or nacos.core.auth.console.enabled=true
|
||||
### The token expiration in seconds:
|
||||
nacos.core.auth.plugin.nacos.token.cache.enable=false
|
||||
nacos.core.auth.plugin.nacos.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000}
|
||||
### The default token (Base64 string):
|
||||
#nacos.core.auth.plugin.nacos.token.secret.key=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
||||
nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:}
|
||||
|
||||
### worked when nacos.core.auth.system.type=ldap?{0} is Placeholder,replace login username
|
||||
#nacos.core.auth.ldap.url=ldap://localhost:389
|
||||
#nacos.core.auth.ldap.basedc=dc=example,dc=org
|
||||
#nacos.core.auth.ldap.userDn=cn=admin,${nacos.core.auth.ldap.basedc}
|
||||
#nacos.core.auth.ldap.password=admin
|
||||
#nacos.core.auth.ldap.userdn=cn={0},dc=example,dc=org
|
||||
#nacos.core.auth.ldap.filter.prefix=uid
|
||||
#nacos.core.auth.ldap.case.sensitive=true
|
||||
#nacos.core.auth.ldap.ignore.partial.result.exception=false
|
||||
|
||||
#*************** Control Plugin Related Configurations ***************#
|
||||
# plugin type
|
||||
#nacos.plugin.control.manager.type=nacos
|
||||
|
||||
# local control rule storage dir, default ${nacos.home}/data/connection and ${nacos.home}/data/tps
|
||||
#nacos.plugin.control.rule.local.basedir=${nacos.home}
|
||||
|
||||
# external control rule storage type, if exist
|
||||
#nacos.plugin.control.rule.external.storage=
|
||||
|
||||
#*************** Config Change Plugin Related Configurations ***************#
|
||||
# webhook
|
||||
#nacos.core.config.plugin.webhook.enabled=false
|
||||
# It is recommended to use EB https://help.aliyun.com/document_detail/413974.html
|
||||
#nacos.core.config.plugin.webhook.url=http://localhost:8080/webhook/send?token=***
|
||||
# The content push max capacity ,byte
|
||||
#nacos.core.config.plugin.webhook.contentMaxCapacity=102400
|
||||
|
||||
# whitelist
|
||||
#nacos.core.config.plugin.whitelist.enabled=false
|
||||
# The import file suffixs
|
||||
#nacos.core.config.plugin.whitelist.suffixs=xml,text,properties,yaml,html
|
||||
# fileformatcheck,which validate the import file of type and content
|
||||
#nacos.core.config.plugin.fileformatcheck.enabled=false
|
||||
|
||||
#*************** Istio Plugin Related Configurations ***************#
|
||||
### If turn on the MCP server:
|
||||
nacos.istio.mcp.server.enabled=false
|
||||
|
||||
#--------------- Nacos Experimental Features Configurations ---------------#
|
||||
|
||||
#*************** K8s Related Configurations ***************#
|
||||
### If turn on the K8s sync:
|
||||
nacos.k8s.sync.enabled=false
|
||||
|
||||
### If use the Java API from an application outside a kubernetes cluster
|
||||
#nacos.k8s.sync.outsideCluster=false
|
||||
#nacos.k8s.sync.kubeConfig=/.kube/config
|
||||
|
||||
#*************** Deployment Type Configuration ***************#
|
||||
|
||||
### Sets the deployment type: 'merged' for joint deployment, 'server' for separate deployment server only, 'console' for separate deployment console only.
|
||||
nacos.deployment.type=merged
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
# spring
|
||||
server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}
|
||||
server.contextPath=/nacos
|
||||
server.port=${NACOS_APPLICATION_PORT:8848}
|
||||
server.tomcat.accesslog.max-days=30
|
||||
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
|
||||
server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false}
|
||||
server.error.include-message=ALWAYS
|
||||
# default current work dir
|
||||
server.tomcat.basedir=file:.
|
||||
#*************** Config Module Related Configurations ***************#
|
||||
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
|
||||
#spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:}
|
||||
spring.sql.init.platform=${SPRING_DATASOURCE_PLATFORM:}
|
||||
nacos.cmdb.dumpTaskInterval=3600
|
||||
nacos.cmdb.eventTaskInterval=10
|
||||
nacos.cmdb.labelTaskInterval=300
|
||||
nacos.cmdb.loadDataAtStart=false
|
||||
db.num=${MYSQL_DATABASE_NUM:1}
|
||||
db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?${MYSQL_SERVICE_DB_PARAM:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false}
|
||||
db.user.0=${MYSQL_SERVICE_USER}
|
||||
db.password.0=${MYSQL_SERVICE_PASSWORD}
|
||||
## DB connection pool settings
|
||||
db.pool.config.connectionTimeout=${DB_POOL_CONNECTION_TIMEOUT:30000}
|
||||
db.pool.config.validationTimeout=10000
|
||||
db.pool.config.maximumPoolSize=20
|
||||
db.pool.config.minimumIdle=2
|
||||
### The auth system to use, currently only 'nacos' and 'ldap' is supported:
|
||||
nacos.core.auth.system.type=${NACOS_AUTH_SYSTEM_TYPE:nacos}
|
||||
### worked when nacos.core.auth.system.type=nacos
|
||||
### The token expiration in seconds:
|
||||
nacos.core.auth.plugin.nacos.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000}
|
||||
### The default token:
|
||||
nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:}
|
||||
### 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=${NACOS_AUTH_CACHE_ENABLE:false}
|
||||
nacos.core.auth.enable.userAgentAuthWhite=${NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE:false}
|
||||
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:}
|
||||
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_VALUE:}
|
||||
## spring security config
|
||||
### turn off security
|
||||
nacos.security.ignore.urls=${NACOS_SECURITY_IGNORE_URLS:/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**}
|
||||
# metrics for elastic search
|
||||
management.metrics.export.elastic.enabled=false
|
||||
management.metrics.export.influx.enabled=false
|
||||
nacos.naming.distro.taskDispatchThreadCount=10
|
||||
nacos.naming.distro.taskDispatchPeriod=200
|
||||
nacos.naming.distro.batchSyncKeyCount=1000
|
||||
nacos.naming.distro.initDataRatio=0.9
|
||||
nacos.naming.distro.syncRetryDelay=5000
|
||||
nacos.naming.data.warmup=true
|
||||
nacos.console.ui.enabled=true
|
||||
nacos.core.param.check.enabled=true
|
||||
|
||||
|
48
changlog
48
changlog
|
@ -1,44 +1,4 @@
|
|||
version:1.3.0
|
||||
增加集群开启嵌入式存储
|
||||
新属性
|
||||
###*************** 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,discovery]
|
||||
## 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 DiscoveryMemberLookup
|
||||
# If you want to use cluster node self-discovery, turn this parameter on
|
||||
# nacos.member.discovery=false
|
||||
## for AddressServerMemberLookup
|
||||
# Maximum number of retries to query the address server upon initialization
|
||||
# nacos.core.address-server.retry=5
|
||||
|
||||
#*************** 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
|
||||
### Requested retries, default value is 1
|
||||
# nacos.core.protocol.raft.data.request_failoverRetries=1
|
||||
### 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, defaults to index
|
||||
# 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
|
||||
version: 2.2.1
|
||||
移除 NACOS_AUTH_TOKEN 默认值
|
||||
移除 NACOS_AUTH_IDENTITY_KEY 默认值
|
||||
移除 NACOS_AUTH_IDENTITY_VALUE 默认值
|
|
@ -0,0 +1,6 @@
|
|||
PREFER_HOST_MODE=hostname
|
||||
MODE=standalone
|
||||
SPRING_DATASOURCE_PLATFORM=mysql
|
||||
NACOS_AUTH_IDENTITY_KEY=2222
|
||||
NACOS_AUTH_IDENTITY_VALUE=2xxx
|
||||
NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
|
@ -2,3 +2,4 @@ MYSQL_ROOT_PASSWORD=root
|
|||
MYSQL_DATABASE=nacos_devtest
|
||||
MYSQL_USER=nacos
|
||||
MYSQL_PASSWORD=nacos
|
||||
LANG=C.UTF-8
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
PREFER_HOST_MODE=hostname
|
||||
EMBEDDED_STORAGE=embedded
|
||||
NACOS_SERVERS=nacos1:8848 nacos2:8848 nacos3:8848
|
||||
MYSQL_SERVICE_DB_NAME=nacos_devtest
|
||||
MYSQL_SERVICE_PORT=3306
|
||||
MYSQL_SERVICE_USER=nacos
|
||||
MYSQL_SERVICE_PASSWORD=nacos
|
||||
NACOS_AUTH_IDENTITY_KEY=2222
|
||||
NACOS_AUTH_IDENTITY_VALUE=2xxx
|
||||
NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
|
@ -1,8 +1,12 @@
|
|||
#nacos dev env
|
||||
PREFER_HOST_MODE=hostname
|
||||
NACOS_SERVERS=nacos1:8848 nacos2:8848 nacos3:8848
|
||||
SPRING_DATASOURCE_PLATFORM=mysql
|
||||
MYSQL_SERVICE_HOST=mysql
|
||||
MYSQL_SERVICE_DB_NAME=nacos_devtest
|
||||
MYSQL_SERVICE_PORT=3306
|
||||
MYSQL_SERVICE_USER=nacos
|
||||
MYSQL_SERVICE_PASSWORD=nacos
|
||||
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
|
||||
NACOS_AUTH_IDENTITY_KEY=2222
|
||||
NACOS_AUTH_IDENTITY_VALUE=2xxx
|
||||
NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#nacos dev env
|
||||
NACOS_SERVERS=172.16.238.10:8848 172.16.238.11:8848 172.16.238.12:8848
|
||||
SPRING_DATASOURCE_PLATFORM=mysql
|
||||
MYSQL_SERVICE_HOST=mysql
|
||||
MYSQL_SERVICE_DB_NAME=nacos_devtest
|
||||
MYSQL_SERVICE_PORT=3306
|
||||
MYSQL_SERVICE_USER=nacos
|
||||
MYSQL_SERVICE_PASSWORD=nacos
|
||||
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
|
||||
NACOS_AUTH_IDENTITY_KEY=2222
|
||||
NACOS_AUTH_IDENTITY_VALUE=2xxx
|
||||
NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
||||
|
|
|
@ -6,4 +6,7 @@ MYSQL_SERVICE_DB_NAME=nacos_devtest
|
|||
MYSQL_SERVICE_PORT=3306
|
||||
MYSQL_SERVICE_USER=nacos
|
||||
MYSQL_SERVICE_PASSWORD=nacos
|
||||
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
|
||||
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
NACOS_AUTH_IDENTITY_KEY=2222
|
||||
NACOS_AUTH_IDENTITY_VALUE=2xxx
|
||||
NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
|
@ -1 +1 @@
|
|||
NACOS_VERSION=v2.1.0-BETA
|
||||
NACOS_VERSION=v3.0.3
|
||||
|
|
|
@ -6,11 +6,12 @@ services:
|
|||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
volumes:
|
||||
- ./cluster-logs/nacos1:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "7848:7848"
|
||||
- "8080:8080"
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
- "9555:9555"
|
||||
- "9868:9848"
|
||||
- "9850:9849"
|
||||
env_file:
|
||||
- ../env/nacos-embedded.env
|
||||
restart: always
|
||||
|
@ -21,10 +22,12 @@ services:
|
|||
container_name: nacos2
|
||||
volumes:
|
||||
- ./cluster-logs/nacos2:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "7849:7848"
|
||||
- "8080:8080"
|
||||
- "8849:8848"
|
||||
- "9849:9848"
|
||||
- "9869:9848"
|
||||
- "9851:9849"
|
||||
env_file:
|
||||
- ../env/nacos-embedded.env
|
||||
restart: always
|
||||
|
@ -34,10 +37,12 @@ services:
|
|||
container_name: nacos3
|
||||
volumes:
|
||||
- ./cluster-logs/nacos3:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "7850:7848"
|
||||
- "8080:8080"
|
||||
- "8850:8848"
|
||||
- "9850:9848"
|
||||
- "9870:9848"
|
||||
- "9852:9849"
|
||||
env_file:
|
||||
- ../env/nacos-embedded.env
|
||||
restart: always
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: "3"
|
||||
version: "3.8"
|
||||
services:
|
||||
nacos1:
|
||||
hostname: nacos1
|
||||
|
@ -6,16 +6,18 @@ services:
|
|||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
volumes:
|
||||
- ./cluster-logs/nacos1:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "7848:7848"
|
||||
- "8080:8080"
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
- "9555:9555"
|
||||
- "9868:9848"
|
||||
- "9850:9849"
|
||||
env_file:
|
||||
- ../env/nacos-hostname.env
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
nacos2:
|
||||
hostname: nacos2
|
||||
|
@ -23,37 +25,51 @@ services:
|
|||
container_name: nacos2
|
||||
volumes:
|
||||
- ./cluster-logs/nacos2:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "7849:7848"
|
||||
- "8080:8080"
|
||||
- "8849:8848"
|
||||
- "9849:9848"
|
||||
- "9869:9848"
|
||||
- "9851:9849"
|
||||
env_file:
|
||||
- ../env/nacos-hostname.env
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
nacos3:
|
||||
hostname: nacos3
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos3
|
||||
volumes:
|
||||
- ./cluster-logs/nacos3:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "7850:7848"
|
||||
- "8080:8080"
|
||||
- "8850:8848"
|
||||
- "9850:9848"
|
||||
- "9870:9848"
|
||||
- "9852:9849"
|
||||
env_file:
|
||||
- ../env/nacos-hostname.env
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
mysql:
|
||||
container_name: mysql
|
||||
image: nacos/nacos-mysql:5.7
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./image/mysql/5.7/Dockerfile
|
||||
image: example/mysql:5.7
|
||||
env_file:
|
||||
- ../env/mysql.env
|
||||
volumes:
|
||||
- ./mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: "2"
|
||||
version: "3.8"
|
||||
services:
|
||||
nacos1:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
|
@ -9,14 +9,15 @@ services:
|
|||
volumes:
|
||||
- ./cluster-logs/nacos1:/home/nacos/logs
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
- "9555:9555"
|
||||
env_file:
|
||||
- ../env/nacos-ip.env
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
nacos2:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
|
@ -27,13 +28,15 @@ services:
|
|||
volumes:
|
||||
- ./cluster-logs/nacos2:/home/nacos/logs
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8849:8848"
|
||||
- "9849:9848"
|
||||
env_file:
|
||||
- ../env/nacos-ip.env
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
nacos3:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos3
|
||||
|
@ -41,18 +44,23 @@ services:
|
|||
nacos_net:
|
||||
ipv4_address: 172.16.238.12
|
||||
volumes:
|
||||
- ./cluster-logs/nacos2:/home/nacos/logs
|
||||
- ./cluster-logs/nacos3:/home/nacos/logs
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8850:8848"
|
||||
- "9850:9848"
|
||||
env_file:
|
||||
- ../env/nacos-ip.env
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
mysql:
|
||||
container_name: mysql
|
||||
image: nacos/nacos-mysql:5.7
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./image/mysql/5.7/Dockerfile
|
||||
image: example/mysql:5.7
|
||||
networks:
|
||||
nacos_net:
|
||||
ipv4_address: 172.16.238.13
|
||||
|
@ -62,6 +70,11 @@ services:
|
|||
- ./mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
networks:
|
||||
nacos_net:
|
||||
driver: bridge
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# Copyright 1999-2023 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.
|
||||
#
|
||||
#127.0.0.1:8848
|
||||
host.docker.internal:8848
|
|
@ -1,29 +1,39 @@
|
|||
version: "2"
|
||||
version: "3.8"
|
||||
services:
|
||||
nacos:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos-standalone-mysql
|
||||
env_file:
|
||||
- ../env/nacos-standlone-mysql.env
|
||||
- ../env/nacos-standalone-mysql.env
|
||||
volumes:
|
||||
- ./standalone-logs/:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
- "9555:9555"
|
||||
- "9849:9849"
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
restart: on-failure
|
||||
mysql:
|
||||
container_name: mysql
|
||||
image: nacos/nacos-mysql:5.7
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./image/mysql/5.7/Dockerfile
|
||||
image: example/mysql:5.7
|
||||
env_file:
|
||||
- ../env/mysql.env
|
||||
volumes:
|
||||
- ./mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
# prometheus:
|
||||
# container_name: prometheus
|
||||
# image: prom/prometheus:latest
|
|
@ -0,0 +1,6 @@
|
|||
ARG TARGETPLATFORM
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} mysql:5.7.40
|
||||
ADD https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
EXPOSE 3306
|
||||
CMD ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
|
@ -0,0 +1,5 @@
|
|||
FROM mysql:5.7.40
|
||||
ADD https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
EXPOSE 3306
|
||||
CMD ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
|
@ -0,0 +1,6 @@
|
|||
ARG TARGETPLATFORM
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} mysql:8.0.31
|
||||
ADD https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
EXPOSE 3306
|
||||
CMD ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
|
@ -0,0 +1,5 @@
|
|||
FROM mysql:8.0.31
|
||||
ADD https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql
|
||||
EXPOSE 3306
|
||||
CMD ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
|
@ -0,0 +1,185 @@
|
|||
#
|
||||
# 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 ***************#
|
||||
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
|
||||
#spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:}
|
||||
spring.sql.init.platform=${SPRING_DATASOURCE_PLATFORM:}
|
||||
# nacos.plugin.datasource.log.enabled=true
|
||||
### Count of DB:
|
||||
db.num=1
|
||||
### Connect URL of DB:
|
||||
db.url.0=jdbc:mysql://mysql:3306/nacos_devtest?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
|
||||
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:
|
||||
### 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
|
||||
### will be removed and replaced by `nacos.naming.clean` properties
|
||||
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
|
||||
### Add in 2.0.0
|
||||
### The interval to clean empty service, unit: milliseconds.
|
||||
# nacos.naming.clean.empty-service.interval=60000
|
||||
### The expired time to clean empty service, unit: milliseconds.
|
||||
# nacos.naming.clean.empty-service.expired-time=60000
|
||||
### The interval to clean expired metadata, unit: milliseconds.
|
||||
# nacos.naming.clean.expired-metadata.interval=5000
|
||||
### The expired time to clean metadata, unit: milliseconds.
|
||||
# nacos.naming.clean.expired-metadata.expired-time=60000
|
||||
### The delay time before push task to execute from service changed, unit: milliseconds.
|
||||
# nacos.naming.push.pushTaskDelay=500
|
||||
### The timeout for push task execute, unit: milliseconds.
|
||||
# nacos.naming.push.pushTaskTimeout=5000
|
||||
### The delay time for retrying failed push task, unit: milliseconds.
|
||||
# nacos.naming.push.pushTaskRetryDelay=1000
|
||||
### Since 2.0.3
|
||||
### The expired time for inactive client, unit: milliseconds.
|
||||
# nacos.naming.client.expired.time=180000
|
||||
#*************** 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
|
||||
### accesslog automatic cleaning time
|
||||
server.tomcat.accesslog.max-days=30
|
||||
### 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' and 'ldap' is supported:
|
||||
nacos.core.auth.system.type=nacos
|
||||
### If turn on auth system:
|
||||
nacos.core.auth.enabled=false
|
||||
### 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=serverIdentity
|
||||
nacos.core.auth.server.identity.value=security
|
||||
### worked when nacos.core.auth.system.type=nacos
|
||||
### The token expiration in seconds:
|
||||
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
|
||||
### The default token (Base64 string):
|
||||
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
|
||||
### worked when nacos.core.auth.system.type=ldap?{0} is Placeholder,replace login username
|
||||
#nacos.core.auth.ldap.url=ldap://localhost:389
|
||||
#nacos.core.auth.ldap.basedc=dc=example,dc=org
|
||||
#nacos.core.auth.ldap.userDn=cn=admin,${nacos.core.auth.ldap.basedc}
|
||||
#nacos.core.auth.ldap.password=admin
|
||||
#nacos.core.auth.ldap.userdn=cn={0},dc=example,dc=org
|
||||
#nacos.core.auth.ldap.filter.prefix=uid
|
||||
#nacos.core.auth.ldap.case.sensitive=true
|
||||
#*************** 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
|
||||
#*************** Distro Related Configurations ***************#
|
||||
### Distro data sync delay time, when sync task delayed, task will be merged for same data key. Default 1 second.
|
||||
# nacos.core.protocol.distro.data.sync.delayMs=1000
|
||||
### Distro data sync timeout for one sync data, default 3 seconds.
|
||||
# nacos.core.protocol.distro.data.sync.timeoutMs=3000
|
||||
### Distro data sync retry delay time when sync data failed or timeout, same behavior with delayMs, default 3 seconds.
|
||||
# nacos.core.protocol.distro.data.sync.retryDelayMs=3000
|
||||
### Distro data verify interval time, verify synced data whether expired for a interval. Default 5 seconds.
|
||||
# nacos.core.protocol.distro.data.verify.intervalMs=5000
|
||||
### Distro data verify timeout for one verify, default 3 seconds.
|
||||
# nacos.core.protocol.distro.data.verify.timeoutMs=3000
|
||||
### Distro data load retry delay when load snapshot data failed, default 30 seconds.
|
||||
# nacos.core.protocol.distro.data.load.retryDelayMs=30000
|
||||
### enable to support prometheus service discovery
|
||||
#nacos.prometheus.metrics.enabled=true
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# 加载 NACOS_VERSION
|
||||
source .env
|
||||
CLEAN_VERSION=${NACOS_VERSION#v}
|
||||
# deal -slim
|
||||
CLEAN_VERSION=${CLEAN_VERSION%-*}
|
||||
|
||||
SCHEMA_URL="https://raw.githubusercontent.com/alibaba/nacos/${CLEAN_VERSION}/distribution/conf/mysql-schema.sql"
|
||||
|
||||
TARGET_DIR="./mysql-init"
|
||||
VERSIONED_FILE="${TARGET_DIR}/${CLEAN_VERSION}-mysql-schema.sql"
|
||||
FINAL_FILE="${TARGET_DIR}/mysql-schema.sql"
|
||||
|
||||
# 创建目录
|
||||
mkdir -p "${TARGET_DIR}"
|
||||
|
||||
# 下载 schema 文件
|
||||
echo "⬇️ Downloading MySQL schema for Nacos ${CLEAN_VERSION}..."
|
||||
curl -sSL "$SCHEMA_URL" -o "${VERSIONED_FILE}"
|
||||
|
||||
# 校验下载
|
||||
if [ ! -s "${VERSIONED_FILE}" ]; then
|
||||
echo "❌ Failed to download schema file from $SCHEMA_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 拷贝为标准文件名供 MySQL 初始化使用
|
||||
cp "${VERSIONED_FILE}" "${FINAL_FILE}"
|
||||
|
||||
# 删除原始版本号文件
|
||||
rm -f "${VERSIONED_FILE}"
|
||||
|
||||
echo "✅ Downloaded and prepared: ${FINAL_FILE}"
|
|
@ -4,14 +4,17 @@ services:
|
|||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos-standalone
|
||||
environment:
|
||||
- PREFER_HOST_MODE=hostname
|
||||
- MODE=standalone
|
||||
- PREFER_HOST_MODE=hostname
|
||||
- MODE=standalone
|
||||
- NACOS_AUTH_IDENTITY_KEY=serverIdentity
|
||||
- NACOS_AUTH_IDENTITY_VALUE=security
|
||||
- NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
|
||||
volumes:
|
||||
- ./standalone-logs/:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
- ./standalone-logs/:/home/nacos/logs
|
||||
ports:
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
- "8080:8080"
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
prometheus:
|
||||
container_name: prometheus
|
||||
image: prom/prometheus:latest
|
||||
|
@ -26,5 +29,5 @@ services:
|
|||
container_name: grafana
|
||||
image: grafana/grafana:latest
|
||||
ports:
|
||||
- 3000:3000
|
||||
- "3000:3000"
|
||||
restart: on-failure
|
|
@ -0,0 +1,49 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
nacos-console:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos-standalone-console
|
||||
environment:
|
||||
- NACOS_DEPLOYMENT_TYPE=console
|
||||
env_file:
|
||||
- ../env/nacos-standalone-mysql.env
|
||||
volumes:
|
||||
- ./standalone-console-logs/:/home/nacos/logs
|
||||
- ./cluster.conf:/home/nacos/conf/cluster.conf
|
||||
ports:
|
||||
- "8080:8080"
|
||||
restart: always
|
||||
nacos-server:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos-standalone-server
|
||||
environment:
|
||||
- NACOS_DEPLOYMENT_TYPE=server
|
||||
env_file:
|
||||
- ../env/nacos-standalone-mysql.env
|
||||
volumes:
|
||||
- ./standalone-server-logs/:/home/nacos/logs
|
||||
ports:
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
restart: always
|
||||
mysql:
|
||||
container_name: mysql
|
||||
image: mysql:8.0.30
|
||||
env_file:
|
||||
- ../env/mysql.env
|
||||
volumes:
|
||||
- ./mysql:/var/lib/mysql
|
||||
- ./mysql-init:/docker-entrypoint-initdb.d/
|
||||
command:
|
||||
--character-set-server=utf8mb4
|
||||
--collation-server=utf8mb4_unicode_ci
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
|
@ -1,28 +0,0 @@
|
|||
version: "2"
|
||||
services:
|
||||
nacos:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos-standalone-mysql
|
||||
env_file:
|
||||
- ../env/nacos-standlone-mysql.env
|
||||
volumes:
|
||||
- ./standalone-logs/:/home/nacos/logs
|
||||
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
|
||||
ports:
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
- "9555:9555"
|
||||
depends_on:
|
||||
- mysql
|
||||
restart: always
|
||||
mysql:
|
||||
container_name: mysql
|
||||
image: nacos/nacos-mysql:8.0.16
|
||||
env_file:
|
||||
- ../env/mysql.env
|
||||
volumes:
|
||||
- ./mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
nacos:
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
container_name: nacos-standalone-mysql
|
||||
env_file:
|
||||
- ../env/nacos-standalone-mysql.env
|
||||
volumes:
|
||||
- ./standalone-logs/:/home/nacos/logs
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
restart: always
|
||||
mysql:
|
||||
container_name: mysql
|
||||
image: mysql:8.0.30
|
||||
env_file:
|
||||
- ../env/mysql.env
|
||||
volumes:
|
||||
- ./mysql:/var/lib/mysql
|
||||
- ./mysql-init:/docker-entrypoint-initdb.d/
|
||||
command:
|
||||
--character-set-server=utf8mb4
|
||||
--collation-server=utf8mb4_unicode_ci
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
|
||||
|
Loading…
Reference in New Issue