安装完成 MySQL 后,启动mysql,容器需要创建一个新的数据库和用户,并授予其访问权限。可以使用以下命令创建一个名为 nacos 的数据库和用户:
1
docker exec -it [容器ID] /bin/bash
1 2 3 4 5 6 7
mysql -u root -p CREATE DATABASE nacos DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'nacos'@'%' IDENTIFIED BY '123456'; GRANT ALL PRIVILEGES ON nacos.* TO 'nacos'@'%'; FLUSH PRIVILEGES; EXIT; EXIT;
# spring server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos} server.contextPath=/nacos server.error.include-message=ALWAYS server.port=8848 spring.datasource.platform=mysql nacos.cmdb.dumpTaskInterval=3600 nacos.cmdb.eventTaskInterval=10 nacos.cmdb.labelTaskInterval=300 nacos.cmdb.loadDataAtStart=false db.num=1 db.url.0=jdbc:mysql://192.168.130.128:3305/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true db.user=nacos db.password=123456 ### The auth system to use, currently only 'nacos' is supported: nacos.core.auth.system.type=nacos ### The token expiration in seconds: nacos.core.auth.default.token.expire.seconds=18000 ### The default token: # 注意:nacos v1.4.7是开启鉴权的,所以需要在application.properties中的配置信息。 # 在application.properties找到nacos.core.auth.default.token.secret.key, # 默认情况下nacos.core.auth.default.token.secret.key是没有值得,所以导致启动nacos后报上面的错, # 根据官网说的,需要在启动nacos前给nacos.core.auth.default.token.secret.key填个256bit的token值, # 也可以复制官网上给的默认token值,SecretKey012345678901234567890123456789012345678901234567890123456789,这样问题就解决了。 nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789 ### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay. nacos.core.auth.caching.enabled=false nacos.core.auth.enable.userAgentAuthWhite=false nacos.core.auth.server.identity.key= nacos.core.auth.server.identity.value= server.tomcat.accesslog.enabled=false server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D # default current work dir server.tomcat.basedir=file:. ## spring security config ### turn off security 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