首页 > 其他分享 >arm架构docker安装nacos

arm架构docker安装nacos

时间:2023-09-08 11:11:55浏览次数:69  
标签:00 varchar DEFAULT nacos arm 128 docker NULL id

前言

搞了个hk1box,装了armbian系统,想用这个当服务器调试微服务,需要安装nacos。尝试安装非docker版本的nacos,去github下载arm版本的并且放到linux下面,运行的时候报tomcat错误,装了tomcat后还是报错,改了很多设置老是跑不了,于是决定用docker版本。

1、挂载目录

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

2、启动容器

这里注意,一定要先启动容器,将容器里面的东西复制到容器外面再进行挂载启动,如果没复制直接挂载,会导致容器启动不了,猜测这样子直接挂载启动是因为conf文件缺少启动不了。

因为使用的是arm架构,这里用大佬构建的zhusaidong/nacos-server-m1:2.0.3这个镜像

docker命令:

docker run --name nacos -d -p 8848:8848 -p 9848:9848 -p 9849:9849 --privileged=true --restart=always -e JVM_XMS=256m -e JVM_XMX=256m -e MODE=standalone -e PREFER_HOST_MODE=hostname zhusaidong/nacos-server-m1:2.0.3

3、复制文件并关闭容器

复制文件

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

关闭容器

docker rm -f nacos

4、数据新增nacos_config表

CREATE TABLE config_info (
  id bigint NOT NULL generated by default as identity,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  tenant_id varchar(128) default '',
  app_name varchar(128),
  content CLOB,
  md5 varchar(32) DEFAULT NULL,
  gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  src_user varchar(128) DEFAULT NULL,
  src_ip varchar(50) DEFAULT NULL,
  c_desc varchar(256) DEFAULT NULL,
  c_use varchar(64) DEFAULT NULL,
  effect varchar(64) DEFAULT NULL,
  type varchar(64) DEFAULT NULL,
  c_schema LONG VARCHAR DEFAULT NULL,
  constraint configinfo_id_key PRIMARY KEY (id),
  constraint uk_configinfo_datagrouptenant UNIQUE (data_id,group_id,tenant_id));

CREATE INDEX configinfo_dataid_key_idx ON config_info(data_id);
CREATE INDEX configinfo_groupid_key_idx ON config_info(group_id);
CREATE INDEX configinfo_dataid_group_key_idx ON config_info(data_id, group_id);

CREATE TABLE his_config_info (
  id bigint NOT NULL,
  nid bigint NOT NULL generated by default as identity,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  tenant_id varchar(128) default '',
  app_name varchar(128),
  content CLOB,
  md5 varchar(32) DEFAULT NULL,
  gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
  gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
  src_user varchar(128),
  src_ip varchar(50) DEFAULT NULL,
  op_type char(10) DEFAULT NULL,
  constraint hisconfiginfo_nid_key PRIMARY KEY (nid));

CREATE INDEX hisconfiginfo_dataid_key_idx ON his_config_info(data_id);
CREATE INDEX hisconfiginfo_gmt_create_idx ON his_config_info(gmt_create);
CREATE INDEX hisconfiginfo_gmt_modified_idx ON his_config_info(gmt_modified);


CREATE TABLE config_info_beta (
  id bigint NOT NULL generated by default as identity,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  tenant_id varchar(128) default '',
  app_name varchar(128),
  content CLOB,
  beta_ips varchar(1024),
  md5 varchar(32) DEFAULT NULL,
  gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  src_user varchar(128),
  src_ip varchar(50) DEFAULT NULL,
  constraint configinfobeta_id_key PRIMARY KEY (id),
  constraint uk_configinfobeta_datagrouptenant UNIQUE (data_id,group_id,tenant_id));

CREATE TABLE config_info_tag (
  id bigint NOT NULL generated by default as identity,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  tenant_id varchar(128) default '',
  tag_id varchar(128) NOT NULL,
  app_name varchar(128),
  content CLOB,
  md5 varchar(32) DEFAULT NULL,
  gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  src_user varchar(128),
  src_ip varchar(50) DEFAULT NULL,
  constraint configinfotag_id_key PRIMARY KEY (id),
  constraint uk_configinfotag_datagrouptenanttag UNIQUE (data_id,group_id,tenant_id,tag_id));

CREATE TABLE config_info_aggr (
  id bigint NOT NULL generated by default as identity,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  tenant_id varchar(128) default '',
  datum_id varchar(255) NOT NULL,
  app_name varchar(128),
  content CLOB,
  gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  constraint configinfoaggr_id_key PRIMARY KEY (id),
  constraint uk_configinfoaggr_datagrouptenantdatum UNIQUE (data_id,group_id,tenant_id,datum_id));

CREATE TABLE app_list (
 id bigint NOT NULL generated by default as identity,
 app_name varchar(128) NOT NULL,
 is_dynamic_collect_disabled smallint DEFAULT 0,
 last_sub_info_collected_time timestamp DEFAULT '1970-01-01 08:00:00.0',
 sub_info_lock_owner varchar(128),
 sub_info_lock_time timestamp DEFAULT '1970-01-01 08:00:00.0',
 constraint applist_id_key PRIMARY KEY (id),
 constraint uk_appname UNIQUE (app_name));

CREATE TABLE app_configdata_relation_subs (
  id bigint NOT NULL generated by default as identity,
  app_name varchar(128) NOT NULL,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  constraint configdatarelationsubs_id_key PRIMARY KEY (id),
  constraint uk_app_sub_config_datagroup UNIQUE (app_name, data_id, group_id));


CREATE TABLE app_configdata_relation_pubs (
  id bigint NOT NULL generated by default as identity,
  app_name varchar(128) NOT NULL,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  constraint configdatarelationpubs_id_key PRIMARY KEY (id),
  constraint uk_app_pub_config_datagroup UNIQUE (app_name, data_id, group_id));

CREATE TABLE config_tags_relation (
  id bigint NOT NULL,
  tag_name varchar(128) NOT NULL,
  tag_type varchar(64) DEFAULT NULL,
  data_id varchar(255) NOT NULL,
  group_id varchar(128) NOT NULL,
  tenant_id varchar(128) DEFAULT '',
  nid bigint NOT NULL generated by default as identity,
  constraint config_tags_id_key PRIMARY KEY (nid),
  constraint uk_configtagrelation_configidtag UNIQUE (id, tag_name, tag_type));

CREATE INDEX config_tags_tenant_id_idx ON config_tags_relation(tenant_id);

CREATE TABLE group_capacity (
  id bigint NOT NULL generated by default as identity,
  group_id varchar(128) DEFAULT '',
  quota int DEFAULT 0,
  usage int DEFAULT 0,
  max_size int DEFAULT 0,
  max_aggr_count int DEFAULT 0,
  max_aggr_size int DEFAULT 0,
  max_history_count int DEFAULT 0,
  gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
  gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  constraint group_capacity_id_key PRIMARY KEY (id),
  constraint uk_group_id UNIQUE (group_id));

CREATE TABLE tenant_capacity (
  id bigint NOT NULL generated by default as identity,
  tenant_id varchar(128) DEFAULT '',
  quota int DEFAULT 0,
  usage int DEFAULT 0,
  max_size int DEFAULT 0,
  max_aggr_count int DEFAULT 0,
  max_aggr_size int DEFAULT 0,
  max_history_count int DEFAULT 0,
  gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
  gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  constraint tenant_capacity_id_key PRIMARY KEY (id),
  constraint uk_tenant_id UNIQUE (tenant_id));

CREATE TABLE tenant_info (
  id bigint NOT NULL generated by default as identity,
  kp varchar(128) NOT NULL,
  tenant_id varchar(128)  DEFAULT '',
  tenant_name varchar(128)  DEFAULT '',
  tenant_desc varchar(256)  DEFAULT NULL,
  create_source varchar(32) DEFAULT NULL,
  gmt_create bigint NOT NULL,
  gmt_modified bigint NOT NULL,
  constraint tenant_info_id_key PRIMARY KEY (id),
  constraint uk_tenant_info_kptenantid UNIQUE (kp,tenant_id));
CREATE INDEX tenant_info_tenant_id_idx ON tenant_info(tenant_id);

CREATE TABLE users (
	username varchar(50) NOT NULL PRIMARY KEY,
	password varchar(500) NOT NULL,
	enabled boolean NOT NULL DEFAULT true
);

CREATE TABLE roles (
	username varchar(50) NOT NULL,
	role varchar(50) NOT NULL,
	constraint uk_username_role UNIQUE (username,role)
);

CREATE TABLE permissions (
    role varchar(50) NOT NULL,
    resource varchar(512) NOT NULL,
    action varchar(8) NOT NULL,
    constraint uk_role_permission UNIQUE (role,resource,action)
);

INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);

INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');


/******************************************/
/*   ipv6 support   */
/******************************************/
ALTER TABLE `config_info_tag`
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;

ALTER TABLE `his_config_info`
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL AFTER `src_user`;

ALTER TABLE `config_info`
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;

ALTER TABLE `config_info_beta`
MODIFY COLUMN `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip' AFTER `src_user`;

5、再次启动容器

进入刚刚挂载的目录,打开application.properties,将数据库按实际需求进行更改

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://10.95.5.79:3306/nacos-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&serverTimezone=Asia/Shanghai
db.user=root
db.password=root
docker run --name nacos -d -p 8848:8848 -p 9848:9848 -p 9849:9849 --privileged=true --restart=always -e JVM_XMS=256m -e JVM_XMX=256m -e MODE=standalone -e PREFER_HOST_MODE=hostname -v /home/nacos/conf:/home/nacos/conf -v /home/nacos/logs:/home/nacos/logs zhusaidong/nacos-server-m1:2.0.3

注意开放9848和9849端口,不然nacos无法被外部连接使用,这里进行了conf和logs目录的挂载

image-20230908104642126

访问地址:ip:8848/nacos

标签:00,varchar,DEFAULT,nacos,arm,128,docker,NULL,id
From: https://www.cnblogs.com/scottyzh/p/17687082.html

相关文章

  • 深入理解容器化部署与Docker
    什么是容器化部署?容器化部署是将应用程序及其所有依赖项打包到一个独立的容器中的方法。容器是一个轻量级、可移植的单元,它可以在不同的环境中运行,而无需担心依赖项问题。容器化部署通常使用容器编排工具(如Kubernetes)来管理和协调容器的部署。为什么使用容器化部署?使用容器化部署的......
  • 安装docker 镜像之后 进入镜像下载报错
    在学习使用docker技术过程中,基于centos镜像自定义新的镜像,其中基础镜像centos需要提前安装好vim和net-tools,然而在刚开始通过yum-yinstallvim安装vim时,便出现了错误提示信息:Error:Failedtodownloadmetadataforrepo'appstream':Cannotprepareinternalm......
  • docker启动mysql报错Can't read dir of '/etc/mysql/conf.d/'
    执行命令:dockerrun-p3306:3306--privileged=true-v/mysql/data:/var/lib/mysql-v/mysql/log:/var/log/mysql-v/mysql/conf:/etc/mysql-eMYSQL_ROOT_PASSWORD=1234--name=mysql-server-dmysql:8.0 错误信息:[ERROR][Entrypoint]:mysqldfailedwhileat......
  • Pycharm快捷键
    折叠(展开)所有代码这里是指按下快捷键后凡是.py文件里可折叠的都折叠。折叠所有代码:Ctrl+Shift+-(减号)展开所有代码:Ctrl+Shift++(加号)折叠(展开)某一层所有代码这里指的是比如if嵌套一个for两个都可折叠,那么光标在 if 按下此快捷键每一层都折叠。折叠某一层所有代码......
  • docker
    0.常用命令#构建Docker镜像:dockerbuild-tyour-image-name:tag.#运行容器:dockerrun-d--nameyour-container-name-phost-port:container-portyour-image-name:tag#查看容器运行状态:dockerps#使用以下命令查看所有容器的状态,包括运行中和已停止的:dockerp......
  • Rust项目使用Dockerfile构建镜像 访问crates.io下载速度慢解决
    在$CARGO_HOME/config文件添加国内的镜像源下面的镜像源来自:https://rsproxy.cn/FROMrust:1.72asbuilderWORKDIR/usr/srcCOPY..RUNecho"[source.crates-io]\n\replace-with='rsproxy-sparse'\n\[source.rsproxy]\n\registry=\"https://rs......
  • Pycharm创建文件时,自动生成文件头注释(作者、日期等信息)
    Pycharm里【文件】-【设置】-【编辑器】-【文件和代码模板】-【PythonScript】里填写自己想要设置的模板内容,点击【确定】或【应用】。模板示例,可以根据自己的需求进行更改#coding:utf-8#Project:${PROJECT_NAME}#File:${NAME}.py#Author:李凤娟#Date:$DATE$TIME#I......
  • HarmonyOS/OpenHarmony(Stage模型)应用开发组合手势(一)连续识别
    组合手势由多种单一手势组合而成,通过在GestureGroup中使用不同的GestureMode来声明该组合手势的类型,支持连续识别、并行识别和互斥识别三种类型。00001. GestureGroup(mode:GestureMode,...gesture:GestureType[])mode:必选参数,为GestureMode枚举类。用于声明该组合手势的类型。ge......
  • docker下的php7.3容器安装gd库
    我的docker版本,24.0.5 我的php版本,php7.3.33题外话,之前我们单独安装php-fpm服务的时候,需要装扩展,是直接在服务器上操作的,那么现在php在docker里面了,我们应该怎么来执行安装操作呢1、进入php容器dockerexec-it1e36f97ab14c/bin/bash//1e36f97ab14c为我的php容器的ID......
  • arm版
    #CentOS-Base.repo##ThemirrorsystemusestheconnectingIPaddressoftheclientandthe#updatestatusofeachmirrortopickmirrorsthatareupdatedtoand#geographicallyclosetotheclient.YoushouldusethisforCentOSupdates#unlessyou......