您的位置:首页 > 健康 > 美食 > 济南智能网站建设费用_餐饮公司网站模板_什么是seo_百度提问

济南智能网站建设费用_餐饮公司网站模板_什么是seo_百度提问

2025/1/11 8:19:44 来源:https://blog.csdn.net/2301_76400852/article/details/142601726  浏览:    关键词:济南智能网站建设费用_餐饮公司网站模板_什么是seo_百度提问
济南智能网站建设费用_餐饮公司网站模板_什么是seo_百度提问

Docker 拉取镜像

docker pull nacos/nacos-server:v2.2.0

挂载目录

如果不是root账号 前面加sudo 或者 切换root账号 su root(命令)

mkdir -p /mydata/nacos/logs/            #新建logs目录
mkdir -p /mydata/nacos/conf/			#新建conf目录

启动容器

docker run -p 8848:8848 --name nacos -d nacos/nacos-server:v2.2.0

复制文件

docker cp nacos:/home/nacos/logs/ /mydata/nacos/
docker cp nacos:/home/nacos/conf/ /mydata/nacos/

关闭容器

docker rm -f nacos
  • PS:这一步启动nacos是为了将nacos里面的文件拷贝出到挂载目录中,这样我们就可以直接修改挂载目录中文件来映射到容器里面去了

mysql中创建nacos所需的表

  • mysql中新建一个库,名字可自定义,这里就用nacos
  • 从github中找到创建表的文件,在nacos-config库中执行,创建所需的表
CREATE TABLE `config_info` (`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'data_id',`group_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`content` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'content',`md5` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'md5',`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',`src_user` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT 'source user',`src_ip` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'source ip',`app_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT '租户字段',`c_desc` varchar(256) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`c_use` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`effect` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`type` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`c_schema` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin,`encrypted_data_key` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT '秘钥',PRIMARY KEY (`id`) USING BTREE,UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='config_info';CREATE TABLE `config_info_aggr` (`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'data_id',`group_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'group_id',`datum_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'datum_id',`content` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '内容',`gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',`app_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT '租户字段',PRIMARY KEY (`id`) USING BTREE,UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='增加租户字段';CREATE TABLE `config_info_beta` (`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'data_id',`group_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'group_id',`app_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'app_name',`content` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'content',`beta_ips` varchar(1024) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'betaIps',`md5` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'md5',`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',`src_user` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT 'source user',`src_ip` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'source ip',`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT '租户字段',`encrypted_data_key` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT '秘钥',PRIMARY KEY (`id`) USING BTREE,UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='config_info_beta';CREATE TABLE `config_info_tag` (`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'data_id',`group_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'group_id',`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT 'tenant_id',`tag_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'tag_id',`app_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'app_name',`content` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'content',`md5` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'md5',`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',`src_user` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT 'source user',`src_ip` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'source ip',PRIMARY KEY (`id`) USING BTREE,UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='config_info_tag';CREATE TABLE `config_tags_relation` (`id` bigint NOT NULL COMMENT 'id',`tag_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'tag_name',`tag_type` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'tag_type',`data_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'data_id',`group_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'group_id',`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT 'tenant_id',`nid` bigint NOT NULL AUTO_INCREMENT,PRIMARY KEY (`nid`) USING BTREE,UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`) USING BTREE,KEY `idx_tenant_id` (`tenant_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='config_tag_relation';CREATE TABLE `group_capacity` (`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',`group_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',`quota` int unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',`usage` int unsigned NOT NULL DEFAULT '0' COMMENT '使用量',`max_size` int unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',`max_aggr_count` int unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',`max_aggr_size` int unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',`max_history_count` int unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',PRIMARY KEY (`id`) USING BTREE,UNIQUE KEY `uk_group_id` (`group_id`) USING BTREE) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='集群、各Group容量信息表';CREATE TABLE `his_config_info` (`id` bigint unsigned NOT NULL,`nid` bigint unsigned NOT NULL AUTO_INCREMENT,`data_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL,`group_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL,`app_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'app_name',`content` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL,`md5` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP,`src_user` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin,`src_ip` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`op_type` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT '租户字段',`encrypted_data_key` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT '秘钥',PRIMARY KEY (`nid`) USING BTREE,KEY `idx_gmt_create` (`gmt_create`) USING BTREE,KEY `idx_gmt_modified` (`gmt_modified`) USING BTREE,KEY `idx_did` (`data_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='多租户改造';CREATE TABLE `permissions` (`role` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`resource` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`action` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,UNIQUE KEY `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;CREATE TABLE `roles` (`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`role` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,UNIQUE KEY `idx_user_role` (`username`,`role`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;CREATE TABLE `tenant_capacity` (`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '' COMMENT 'Tenant ID',`quota` int unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',`usage` int unsigned NOT NULL DEFAULT '0' COMMENT '使用量',`max_size` int unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',`max_aggr_count` int unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',`max_aggr_size` int unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',`max_history_count` int unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',PRIMARY KEY (`id`) USING BTREE,UNIQUE KEY `uk_tenant_id` (`tenant_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='租户容量信息表';CREATE TABLE `tenant_info` (`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',`kp` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'kp',`tenant_id` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT 'tenant_id',`tenant_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT '' COMMENT 'tenant_name',`tenant_desc` varchar(256) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'tenant_desc',`create_source` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'create_source',`gmt_create` bigint DEFAULT NULL COMMENT '创建时间',`gmt_modified` bigint DEFAULT NULL COMMENT '修改时间',PRIMARY KEY (`id`) USING BTREE,UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`) USING BTREE,KEY `idx_tenant_id` (`tenant_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='tenant_info';CREATE TABLE `users` (`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`password` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`enabled` tinyint(1) NOT NULL,PRIMARY KEY (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;

启动nacos

docker run -d \--name nacos \-p 8848:8848 -p 9848:9848 -p 9849:9849 \-e JVM_XMS=256m \-e JVM_XMX=256m \-e MODE=standalone \-e SPRING_DATASOURCE_PLATFORM=mysql \  # 配置 MySQL-e MYSQL_SERVICE_HOST=host.docker.internal \ # 或主机IP,取决于你的环境-e MYSQL_SERVICE_PORT=3306 \-e MYSQL_SERVICE_USER=root \   #替换为 你的 mysql 用户名 -e MYSQL_SERVICE_PASSWORD=your_mysql_password \ # 替换为你的 MySQL 密码-e MYSQL_SERVICE_DB_NAME=nacos \-e TIME_ZONE='Asia/Shanghai' \-v /mydata/nacos/logs:/home/nacos/logs \ # 修正挂载路径-v /mydata/nacos/conf:/home/nacos/conf \ # 修正挂载路径--restart=always \nacos/nacos-server:v2.2.0 # 指定镜像版本

注意事项

  1. 需要在防火墙开放相关端口,如果你是云服务器,开放安全组
## 开放端口8848 9848 9849
firewall-cmd --zone=public --add-port=8848/tcp --permanent
firewall-cmd --zone=public --add-port=9848/tcp --permanent
firewall-cmd --zone=public --add-port=9849/tcp --permanent## 重启防火墙
firewall-cmd --reload## 查看所有开启的端口
firewall-cmd --zone=public --list-ports

如果 开放端口报错 可能是没安装防火墙工具 如果登录的是root账号前面不用加 sudo

sudo apt update
sudo apt install firewalld

启动并设置开机自启 firewalld(可选但通常建议)

sudo systemctl start firewalld
sudo systemctl enable firewalld

重启docker

systemctl restart docker

修改配置文件

  • 主要修改的是application.properties文件
vim /mydata/nacos/conf/application.properties

如果报错:Command 'vim' not found, but can be installed with:

安装vim插件

sudo apt update
sudo apt install vim

重新执行

vim /mydata/nacos/conf/application.properties

修改你的application.properties文件 对应自己的ip 数据库名 用户名 密码

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://localhost:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=30000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=root

访问页面

http://ip:8848/nacos/index.html

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com