Standalone Deployment
Nacos Standalone Mode
1. Release Package Deployment
1.1. Deployment Steps
In Quick Start, the built-in Derby database is used to quickly deploy Nacos in standalone mode. You can refer to that document to deploy Nacos standalone mode with Derby.
Refer to Quick Start to prepare the Nacos environment and download the release package.
When deploying Nacos standalone mode with a MySQL data source, prepare the MySQL database yourself:
-
- Install the database. The required version is 5.6.5 or later.
-
- Initialize the MySQL database. Database initialization file: mysql-schema.sql.
Then modify ${nacos.home}/conf/application.properties, add the MySQL data source configuration, and configure the MySQL data source URL, username, and password.
spring.sql.init.platform=mysql
db.num=1db.url.0=jdbc:mysql://${mysql_host}:${mysql_port}/${nacos_database}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=truedb.user=${mysql_user}db.password=${mysql_password}Then follow Quick Start - Start Server to modify the Nacos authentication configuration. Finally, follow Quick Start - Start Server to start Nacos.
1.2. Advanced Configuration
Nacos provides rich configuration items that help you tune Nacos performance and control Nacos features, such as authentication, monitoring, databases, connections, and logs. For details, see System Parameters.
2. Docker Deployment
2.1. Deployment Steps
In Quick Start Docker, Docker is used with the built-in Derby database to quickly deploy Nacos in standalone mode. You can refer to that document to deploy Nacos standalone mode with Derby.
Run the docker-compose command to start Nacos.
docker-compose -f example/standalone-mysql-8.yaml upTo use MySQL 5.7
docker-compose -f example/standalone-mysql-5.7.yaml up2.2. Advanced Configuration
If you need many custom configurations, you can configure them by specifying System Parameters - Image Environment Variables. For example, to enable authentication:
docker run --name nacos-standalone-auth -e MODE=standalone -e NACOS_AUTH_ENABLE=true -e NACOS_AUTH_TOKEN=${customToken} -e NACOS_AUTH_IDENTITY_KEY=${customKey} -e NACOS_AUTH_IDENTITY_VALUE=${customValue} -p 8848:8848 -d -p 9848:9848 nacos/nacos-server:latestYou can also mount the application.properties file to import more complex custom configurations into the Nacos container. This method is strongly recommended for production environments. Example:
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:latestIf this still cannot meet your customization requirements, you can build an image based on the Dockerfile in the nacos-docker project.
3. Kubernetes Deployment
Kubernetes does not currently provide standalone-mode deployment. Cluster-mode deployment is recommended.