在【Cencos7】中安装【Nacos】并适配【PostgreSQL】数据库

在【Cencos7】中安装【Nacos-2.3.0】并适配【PostgreSQL】数据库

安装JDK

wget命令下载:
wget https://repo.huaweicloud.com/java/jdk/8u151-b12/jdk-8u151-linux-x64.tar.gz
解压
tar -xzvf jdk-7u80-linux-x64.tar.gz
将解压后的目录移动到/opt下
sudo mv jdk1.8.0_151 /opt/jdk1.8.0_151
配置环境变量
# 编辑环境变量 下面两个命令二选一即可
vim /etc/profile 
#sudo vim /etc/profile.d/jdk.sh# 输入ins键进行编辑,加入以下内容,jdk目录名记得换成自己的名字
export JAVA_HOME=/opt/jdk1.8.0_151
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin# 按下esc,进入命令行模式
# 再输入“:wq!”,强制保存退出# 让环境变量生效
source /etc/profile

安装nacos

下载nacos

下载完成后上传到Linux服务器目录中,例如 /home/nacos

解压nacos 并移动到/opt目录下
#进入nacos所在目录
cd /home/nacos#加压nacos
tar -zxvf nacos-server-2.3.0.tar.gz
#将解压后的目录移动到 /opt下
sudo mv nacos-server-2.3.0 /opt/nacos
启动测试
# 进入nacos bin 目录
cd /opt/nacos/bin#单机模式启动
sudo sh startup.sh -m standalone

访问:http://ip:8848/nacos/index.html 测试

修改配置文件
# 进入配置文件所在目录
cd /opt/nacos/conf#编辑
vim application.properties

在这里插入图片描述

初始化pgsql
/* 创建数据库 */
create database nacos;

初始化所需表

/** Copyright 1999-2018 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.*/-- ----------------------------
-- Table structure for config_info
-- ----------------------------
DROP TABLE IF EXISTS "config_info";
CREATE TABLE "config_info" ("id" bigserial NOT NULL,"data_id" varchar(255)  NOT NULL,"group_id" varchar(255) ,"content" text  NOT NULL,"md5" varchar(32) ,"gmt_create" timestamp(6) NOT NULL,"gmt_modified" timestamp(6) NOT NULL,"src_user" text ,"src_ip" varchar(20) ,"app_name" varchar(128) ,"tenant_id" varchar(128) ,"c_desc" varchar(256) ,"c_use" varchar(64) ,"effect" varchar(64) ,"type" varchar(64) ,"c_schema" text ,"encrypted_data_key" text  NOT NULL
)
;COMMENT ON COLUMN "config_info"."id" IS 'id';
COMMENT ON COLUMN "config_info"."data_id" IS 'data_id';
COMMENT ON COLUMN "config_info"."content" IS 'content';
COMMENT ON COLUMN "config_info"."md5" IS 'md5';
COMMENT ON COLUMN "config_info"."gmt_create" IS '创建时间';
COMMENT ON COLUMN "config_info"."gmt_modified" IS '修改时间';
COMMENT ON COLUMN "config_info"."src_user" IS 'source user';
COMMENT ON COLUMN "config_info"."src_ip" IS 'source ip';
COMMENT ON COLUMN "config_info"."tenant_id" IS '租户字段';
COMMENT ON COLUMN "config_info"."encrypted_data_key" IS '秘钥';
COMMENT ON TABLE "config_info" IS 'config_info';-- ----------------------------
-- Table structure for config_info_aggr
-- ----------------------------
DROP TABLE IF EXISTS "config_info_aggr";
CREATE TABLE "config_info_aggr" ("id" bigserial NOT NULL,"data_id" varchar(255)  NOT NULL,"group_id" varchar(255)  NOT NULL,"datum_id" varchar(255)  NOT NULL,"content" text  NOT NULL,"gmt_modified" timestamp(6) NOT NULL,"app_name" varchar(128) ,"tenant_id" varchar(128) 
)
;
COMMENT ON COLUMN "config_info_aggr"."id" IS 'id';
COMMENT ON COLUMN "config_info_aggr"."data_id" IS 'data_id';
COMMENT ON COLUMN "config_info_aggr"."group_id" IS 'group_id';
COMMENT ON COLUMN "config_info_aggr"."datum_id" IS 'datum_id';
COMMENT ON COLUMN "config_info_aggr"."content" IS '内容';
COMMENT ON COLUMN "config_info_aggr"."gmt_modified" IS '修改时间';
COMMENT ON COLUMN "config_info_aggr"."tenant_id" IS '租户字段';
COMMENT ON TABLE "config_info_aggr" IS '增加租户字段';-- ----------------------------
-- Records of config_info_aggr
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for config_info_beta
-- ----------------------------
DROP TABLE IF EXISTS "config_info_beta";
CREATE TABLE "config_info_beta" ("id" bigserial NOT NULL,"data_id" varchar(255)  NOT NULL,"group_id" varchar(128)  NOT NULL,"app_name" varchar(128) ,"content" text  NOT NULL,"beta_ips" varchar(1024) ,"md5" varchar(32) ,"gmt_create" timestamp(6) NOT NULL,"gmt_modified" timestamp(6) NOT NULL,"src_user" text ,"src_ip" varchar(20) ,"tenant_id" varchar(128) ,"encrypted_data_key" text  NOT NULL
)
;
COMMENT ON COLUMN "config_info_beta"."id" IS 'id';
COMMENT ON COLUMN "config_info_beta"."data_id" IS 'data_id';
COMMENT ON COLUMN "config_info_beta"."group_id" IS 'group_id';
COMMENT ON COLUMN "config_info_beta"."app_name" IS 'app_name';
COMMENT ON COLUMN "config_info_beta"."content" IS 'content';
COMMENT ON COLUMN "config_info_beta"."beta_ips" IS 'betaIps';
COMMENT ON COLUMN "config_info_beta"."md5" IS 'md5';
COMMENT ON COLUMN "config_info_beta"."gmt_create" IS '创建时间';
COMMENT ON COLUMN "config_info_beta"."gmt_modified" IS '修改时间';
COMMENT ON COLUMN "config_info_beta"."src_user" IS 'source user';
COMMENT ON COLUMN "config_info_beta"."src_ip" IS 'source ip';
COMMENT ON COLUMN "config_info_beta"."tenant_id" IS '租户字段';
COMMENT ON COLUMN "config_info_beta"."encrypted_data_key" IS '秘钥';
COMMENT ON TABLE "config_info_beta" IS 'config_info_beta';-- ----------------------------
-- Records of config_info_beta
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for config_info_tag
-- ----------------------------
DROP TABLE IF EXISTS "config_info_tag";
CREATE TABLE "config_info_tag" ("id" bigserial NOT NULL,"data_id" varchar(255)  NOT NULL,"group_id" varchar(128)  NOT NULL,"tenant_id" varchar(128) ,"tag_id" varchar(128)  NOT NULL,"app_name" varchar(128) ,"content" text  NOT NULL,"md5" varchar(32) ,"gmt_create" timestamp(6) NOT NULL,"gmt_modified" timestamp(6) NOT NULL,"src_user" text ,"src_ip" varchar(20) 
)
;
COMMENT ON COLUMN "config_info_tag"."id" IS 'id';
COMMENT ON COLUMN "config_info_tag"."data_id" IS 'data_id';
COMMENT ON COLUMN "config_info_tag"."group_id" IS 'group_id';
COMMENT ON COLUMN "config_info_tag"."tenant_id" IS 'tenant_id';
COMMENT ON COLUMN "config_info_tag"."tag_id" IS 'tag_id';
COMMENT ON COLUMN "config_info_tag"."app_name" IS 'app_name';
COMMENT ON COLUMN "config_info_tag"."content" IS 'content';
COMMENT ON COLUMN "config_info_tag"."md5" IS 'md5';
COMMENT ON COLUMN "config_info_tag"."gmt_create" IS '创建时间';
COMMENT ON COLUMN "config_info_tag"."gmt_modified" IS '修改时间';
COMMENT ON COLUMN "config_info_tag"."src_user" IS 'source user';
COMMENT ON COLUMN "config_info_tag"."src_ip" IS 'source ip';
COMMENT ON TABLE "config_info_tag" IS 'config_info_tag';-- ----------------------------
-- Records of config_info_tag
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for config_tags_relation
-- ----------------------------
DROP TABLE IF EXISTS "config_tags_relation";
CREATE TABLE "config_tags_relation" ("id" bigserial NOT NULL,"tag_name" varchar(128)  NOT NULL,"tag_type" varchar(64) ,"data_id" varchar(255)  NOT NULL,"group_id" varchar(128)  NOT NULL,"tenant_id" varchar(128) ,"nid" bigserial NOT NULL
)
;
COMMENT ON COLUMN "config_tags_relation"."id" IS 'id';
COMMENT ON COLUMN "config_tags_relation"."tag_name" IS 'tag_name';
COMMENT ON COLUMN "config_tags_relation"."tag_type" IS 'tag_type';
COMMENT ON COLUMN "config_tags_relation"."data_id" IS 'data_id';
COMMENT ON COLUMN "config_tags_relation"."group_id" IS 'group_id';
COMMENT ON COLUMN "config_tags_relation"."tenant_id" IS 'tenant_id';
COMMENT ON TABLE "config_tags_relation" IS 'config_tag_relation';-- ----------------------------
-- Records of config_tags_relation
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for group_capacity
-- ----------------------------
DROP TABLE IF EXISTS "group_capacity";
CREATE TABLE "group_capacity" ("id" bigserial NOT NULL,"group_id" varchar(128)  NOT NULL,"quota" int4 NOT NULL,"usage" int4 NOT NULL,"max_size" int4 NOT NULL,"max_aggr_count" int4 NOT NULL,"max_aggr_size" int4 NOT NULL,"max_history_count" int4 NOT NULL,"gmt_create" timestamp(6) NOT NULL,"gmt_modified" timestamp(6) NOT NULL
)
;
COMMENT ON COLUMN "group_capacity"."id" IS '主键ID';
COMMENT ON COLUMN "group_capacity"."group_id" IS 'Group ID,空字符表示整个集群';
COMMENT ON COLUMN "group_capacity"."quota" IS '配额,0表示使用默认值';
COMMENT ON COLUMN "group_capacity"."usage" IS '使用量';
COMMENT ON COLUMN "group_capacity"."max_size" IS '单个配置大小上限,单位为字节,0表示使用默认值';
COMMENT ON COLUMN "group_capacity"."max_aggr_count" IS '聚合子配置最大个数,,0表示使用默认值';
COMMENT ON COLUMN "group_capacity"."max_aggr_size" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值';
COMMENT ON COLUMN "group_capacity"."max_history_count" IS '最大变更历史数量';
COMMENT ON COLUMN "group_capacity"."gmt_create" IS '创建时间';
COMMENT ON COLUMN "group_capacity"."gmt_modified" IS '修改时间';
COMMENT ON TABLE "group_capacity" IS '集群、各Group容量信息表';-- ----------------------------
-- Records of group_capacity
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for his_config_info
-- ----------------------------
DROP TABLE IF EXISTS "his_config_info";
CREATE TABLE "his_config_info" ("id" int8 NOT NULL,"nid" bigserial NOT NULL,"data_id" varchar(255)  NOT NULL,"group_id" varchar(128)  NOT NULL,"app_name" varchar(128) ,"content" text  NOT NULL,"md5" varchar(32) ,"gmt_create" timestamp(6) NOT NULL  DEFAULT '2010-05-05 00:00:00',"gmt_modified" timestamp(6) NOT NULL,"src_user" text ,"src_ip" varchar(20) ,"op_type" char(10) ,"tenant_id" varchar(128) ,"encrypted_data_key" text  NOT NULL
)
;
COMMENT ON COLUMN "his_config_info"."app_name" IS 'app_name';
COMMENT ON COLUMN "his_config_info"."tenant_id" IS '租户字段';
COMMENT ON COLUMN "his_config_info"."encrypted_data_key" IS '秘钥';
COMMENT ON TABLE "his_config_info" IS '多租户改造';-- ----------------------------
-- Table structure for permissions
-- ----------------------------
DROP TABLE IF EXISTS "permissions";
CREATE TABLE "permissions" ("role" varchar(50)  NOT NULL,"resource" varchar(512)  NOT NULL,"action" varchar(8)  NOT NULL
)
;-- ----------------------------
-- Records of permissions
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for roles
-- ----------------------------
DROP TABLE IF EXISTS "roles";
CREATE TABLE "roles" ("username" varchar(50)  NOT NULL,"role" varchar(50)  NOT NULL
)
;-- ----------------------------
-- Records of roles
-- ----------------------------
BEGIN;
INSERT INTO "roles" VALUES ('nacos', 'ROLE_ADMIN');
COMMIT;-- ----------------------------
-- Table structure for tenant_capacity
-- ----------------------------
DROP TABLE IF EXISTS "tenant_capacity";
CREATE TABLE "tenant_capacity" ("id" bigserial NOT NULL,"tenant_id" varchar(128)  NOT NULL,"quota" int4 NOT NULL,"usage" int4 NOT NULL,"max_size" int4 NOT NULL,"max_aggr_count" int4 NOT NULL,"max_aggr_size" int4 NOT NULL,"max_history_count" int4 NOT NULL,"gmt_create" timestamp(6) NOT NULL,"gmt_modified" timestamp(6) NOT NULL
)
;
COMMENT ON COLUMN "tenant_capacity"."id" IS '主键ID';
COMMENT ON COLUMN "tenant_capacity"."tenant_id" IS 'Tenant ID';
COMMENT ON COLUMN "tenant_capacity"."quota" IS '配额,0表示使用默认值';
COMMENT ON COLUMN "tenant_capacity"."usage" IS '使用量';
COMMENT ON COLUMN "tenant_capacity"."max_size" IS '单个配置大小上限,单位为字节,0表示使用默认值';
COMMENT ON COLUMN "tenant_capacity"."max_aggr_count" IS '聚合子配置最大个数';
COMMENT ON COLUMN "tenant_capacity"."max_aggr_size" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值';
COMMENT ON COLUMN "tenant_capacity"."max_history_count" IS '最大变更历史数量';
COMMENT ON COLUMN "tenant_capacity"."gmt_create" IS '创建时间';
COMMENT ON COLUMN "tenant_capacity"."gmt_modified" IS '修改时间';
COMMENT ON TABLE "tenant_capacity" IS '租户容量信息表';-- ----------------------------
-- Records of tenant_capacity
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for tenant_info
-- ----------------------------
DROP TABLE IF EXISTS "tenant_info";
CREATE TABLE "tenant_info" ("id" bigserial NOT NULL,"kp" varchar(128)  NOT NULL,"tenant_id" varchar(128) ,"tenant_name" varchar(128) ,"tenant_desc" varchar(256) ,"create_source" varchar(32) ,"gmt_create" int8 NOT NULL,"gmt_modified" int8 NOT NULL
)
;
COMMENT ON COLUMN "tenant_info"."id" IS 'id';
COMMENT ON COLUMN "tenant_info"."kp" IS 'kp';
COMMENT ON COLUMN "tenant_info"."tenant_id" IS 'tenant_id';
COMMENT ON COLUMN "tenant_info"."tenant_name" IS 'tenant_name';
COMMENT ON COLUMN "tenant_info"."tenant_desc" IS 'tenant_desc';
COMMENT ON COLUMN "tenant_info"."create_source" IS 'create_source';
COMMENT ON COLUMN "tenant_info"."gmt_create" IS '创建时间';
COMMENT ON COLUMN "tenant_info"."gmt_modified" IS '修改时间';
COMMENT ON TABLE "tenant_info" IS 'tenant_info';-- ----------------------------
-- Records of tenant_info
-- ----------------------------
BEGIN;
COMMIT;-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" ("username" varchar(50)  NOT NULL,"password" varchar(500)  NOT NULL,"enabled" boolean NOT NULL
)
;-- ----------------------------
-- Records of users
-- ----------------------------
BEGIN;
INSERT INTO "users" VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
COMMIT;-- ----------------------------
-- Indexes structure for table config_info
-- ----------------------------
CREATE UNIQUE INDEX "uk_configinfo_datagrouptenant" ON "config_info" ("data_id","group_id","tenant_id");-- ----------------------------
-- Primary Key structure for table config_info
-- ----------------------------
ALTER TABLE "config_info" ADD CONSTRAINT "config_info_pkey" PRIMARY KEY ("id");-- ----------------------------
-- Indexes structure for table config_info_aggr
-- ----------------------------
CREATE UNIQUE INDEX "uk_configinfoaggr_datagrouptenantdatum" ON "config_info_aggr" USING btree ("data_id","group_id","tenant_id","datum_id");-- ----------------------------
-- Primary Key structure for table config_info_aggr
-- ----------------------------
ALTER TABLE "config_info_aggr" ADD CONSTRAINT "config_info_aggr_pkey" PRIMARY KEY ("id");-- ----------------------------
-- Indexes structure for table config_info_beta
-- ----------------------------
CREATE UNIQUE INDEX "uk_configinfobeta_datagrouptenant" ON "config_info_beta" USING btree ("data_id","group_id","tenant_id");-- ----------------------------
-- Primary Key structure for table config_info_beta
-- ----------------------------
ALTER TABLE "config_info_beta" ADD CONSTRAINT "config_info_beta_pkey" PRIMARY KEY ("id");-- ----------------------------
-- Indexes structure for table config_info_tag
-- ----------------------------
CREATE UNIQUE INDEX "uk_configinfotag_datagrouptenanttag" ON "config_info_tag" USING btree ("data_id","group_id","tenant_id","tag_id");-- ----------------------------
-- Primary Key structure for table config_info_tag
-- ----------------------------
ALTER TABLE "config_info_tag" ADD CONSTRAINT "config_info_tag_pkey" PRIMARY KEY ("id");-- ----------------------------
-- Indexes structure for table config_tags_relation
-- ----------------------------
CREATE INDEX "idx_tenant_id" ON "config_tags_relation" USING btree ("tenant_id"
);
CREATE UNIQUE INDEX "uk_configtagrelation_configidtag" ON "config_tags_relation" USING btree ("id","tag_name","tag_type"
);-- ----------------------------
-- Primary Key structure for table config_tags_relation
-- ----------------------------
ALTER TABLE "config_tags_relation" ADD CONSTRAINT "config_tags_relation_pkey" PRIMARY KEY ("nid");-- ----------------------------
-- Indexes structure for table group_capacity
-- ----------------------------
CREATE UNIQUE INDEX "uk_group_id" ON "group_capacity" USING btree ("group_id"
);-- ----------------------------
-- Primary Key structure for table group_capacity
-- ----------------------------
ALTER TABLE "group_capacity" ADD CONSTRAINT "group_capacity_pkey" PRIMARY KEY ("id");-- ----------------------------
-- Indexes structure for table his_config_info
-- ----------------------------
CREATE INDEX "idx_did" ON "his_config_info" USING btree ("data_id"
);
CREATE INDEX "idx_gmt_create" ON "his_config_info" USING btree ("gmt_create"
);
CREATE INDEX "idx_gmt_modified" ON "his_config_info" USING btree ("gmt_modified"
);-- ----------------------------
-- Primary Key structure for table his_config_info
-- ----------------------------
ALTER TABLE "his_config_info" ADD CONSTRAINT "his_config_info_pkey" PRIMARY KEY ("nid");-- ----------------------------
-- Indexes structure for table permissions
-- ----------------------------
CREATE UNIQUE INDEX "uk_role_permission" ON "permissions" USING btree ("role","resource","action"
);-- ----------------------------
-- Indexes structure for table roles
-- ----------------------------
CREATE UNIQUE INDEX "uk_username_role" ON "roles" USING btree ("username","role"
);-- ----------------------------
-- Indexes structure for table tenant_capacity
-- ----------------------------
CREATE UNIQUE INDEX "uk_tenant_id" ON "tenant_capacity" USING btree ("tenant_id"
);-- ----------------------------
-- Primary Key structure for table tenant_capacity
-- ----------------------------
ALTER TABLE "tenant_capacity" ADD CONSTRAINT "tenant_capacity_pkey" PRIMARY KEY ("id");-- ----------------------------
-- Indexes structure for table tenant_info
-- ----------------------------
CREATE UNIQUE INDEX "uk_tenant_info_kptenantid" ON "tenant_info" USING btree ("kp","tenant_id"
);
配置启动脚本
groupadd nacos
useradd -g nacos -s /usr/sbin/nologin nacos
chown -R nacos:nacos nacos
chmod +x nacos/bin/*.sh

编辑 nacos.service

vim /etc/systemd/system/nacos.service

写入下面内容:

[Unit]
Description=nacos
After=network.target[Service]
Type=forking
User=nacos
Group=nacosEnvironment='JAVA_HOME=/opt/jdk'ExecStart=sh /opt/nacos/bin/startup.sh -m standalone
ExecStop=sh /opt/nacos/bin/shutdown.sh[Install]
WantedBy=multi-user.target

设置开机启动 nacos

systemctl enable nacos

启动 nacos

systemctl start nacos

查看启动状态

systemctl status nacos

踩坑:

网上提供的修改application.properties文件的方式如下,测试后发现不能用,db.pool.config.driverClassName不识别。且注释db.pool.config.driverClassName,启动时数据库连接异常,启动不了。替换为上文中的方式配置后解决。

### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
spring.sql.init.platform=postgresql### Count of DB:
db.num=1### Connect URL of DB:
db.url.0=jdbc:postgresql://localhost:5432/nacos?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos-server
db.user.0=postgres
db.password.0=123456### Connection pool configuration: hikariCP
db.pool.config.driverClassName=org.postgresql.Driver

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/812809.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

二叉树遍历算法和应用

二叉树是指度为 2 的树。它是一种最简单却又最重要的树,在计算机领域中有这广泛的应用。 二叉树的递归定义如下:二叉树是一棵空树,或者一棵由一个根节点和两棵互不相交的分别称为根节点的左子树和右子树所组成的非空树,左子树和右…

【前端】解决前端图表大数据配色难题:利用HSL动态生成颜色方案

解决前端图表大数据配色难题:利用HSL动态生成颜色方案 在数据可视化项目中,尤其是当需要绘制包含大量数据点的图表时,一个常见的挑战是如何为每个数据点分配一个独特而又视觉上容易区分的颜色。使用固定的颜色列表可能在数据点数量超过列表限…

信号完整性之特性阻抗那些事儿

原文来自微信公众号:工程师看海,与我联系:chunhou0820 看海原创视频教程:《运放秘籍》 大家好,我是工程师看海。 我们经常说控制阻抗,这个阻抗是什么意思呢? 信号在传输线中,是一步…

使用Android Studio制作一个蓝牙软件 ---(一)

一、创建项目(项目名称---BluetoothActivity) 二、创建HomeActivity页面 1.点击一个文件夹 --- 鼠标右击 --- 新建 --- Acyivity --- Empty Views Activity 三、创建styles.xml 点击 values文件夹 --- 鼠标右击 --- 新建 --- Values Resource File sty…

【数据结构】04串

串 1. 定义2. 串的比较3. 串的存储结构4. 具体实现5. 模式匹配5.1 常规思路实现5.2 KMP模式匹配算法5.2.1 next数组计算5.2.1 代码计算next数组5.2.2 KMP算法实现 1. 定义 串(string)是由零个或多个字符组成的有限序列,又叫字符串。 一般记为s a 1 , a 2 , . . . ,…

NGO-VMD+皮尔逊系数+小波阈值降噪+重构

NGO-VMD皮尔逊系数小波阈值降噪重构 NGO-VMD皮尔逊系数小波阈值降噪重构代码获取戳此处代码获取戳此处 以西储大学轴承数据为例,进行VMD,且采用NGO进行K a参数寻优 并对分解分量计算皮尔逊相关系数筛选含噪声分量,对其进行小波软硬阈值降噪&a…

C/C++内存泄漏及检测

“该死系统存在内存泄漏问题”,项目中由于各方面因素,总是有人抱怨存在内存泄漏,系统长时间运行之后,可用内存越来越少,甚至导致了某些服务失败。内存泄漏是最难发现的常见错误之一,因为除非用完内存或调用…

【JAVA基础篇教学】第十篇:Java中Map详解说明

博主打算从0-1讲解下java基础教学,今天教学第十篇:Java中Map详解说明。 在 Java 编程中,Map 接口代表了一种键值对的集合,每个键对应一个值。Map 接口提供了一系列操作方法,可以方便地对键值对进行增删改查等操作。本…

模板方法模式:定义算法骨架的设计策略

在软件开发中,模板方法模式是一种行为型设计模式,它在父类中定义一个操作的算法框架,允许子类在不改变算法结构的情况下重定义算法的某些步骤。这种模式是基于继承的基本原则,通过抽象类达到代码复用的目的。本文将详细介绍模板方…

NASA数据集——亚洲夏季季风化学与气候影响项目超高灵敏度气溶胶光谱(UHSAS)数据

ACCLIP_Aerosol_AircraftInSitu_WB57_Data 简介 ACCLIP_Aerosol_AircraftInSitu_WB57_Data 是亚洲夏季季风化学与气候影响项目(ACCLIP)期间收集的原地气溶胶数据。本数据集收录了来自下一代激光质谱仪(PALMS-NG)、单颗粒烟尘光度…

一文读懂Partisia Blockchain,被严重低估的隐私区块链生态

在今年 3 月,隐私公链 Partisia Blockchain 迎来了重要的进展,该生态通证 $MPC 上线了交易所,目前 $MPC 通证可以在 Kucoin、Gate、BitMart、Bitfinex、Bitture 等平台交易,并将在不久后上线 MEXC 平台。 ​ 在上个月上线市场至今…

【项目实战】记录一次PG数据库迁移至GaussDB测试(上)

目录 一、说明 1.1、参考文档 1.2、注意事项 1.3、环境基本情况 二、GaussDB新环境安装 2.1 配置操作环境变量 2.1.1 关闭防火墙 步骤1 执行以下命令,检查防火墙是否关闭。 步骤2 执行以下命令,关闭防火墙并禁止开机启动。 步骤3 修改/etc/sel…

单细胞RNA测序(scRNA-seq)Cellranger流程入门和数据质控

单细胞RNA测序(scRNA-seq)Cellranger流程入门和数据质控 单细胞RNA测序(scRNA-seq)基础知识可查看以下文章: 单细胞RNA测序(scRNA-seq)工作流程入门 单细胞RNA测序(scRNA-seq)细胞分离与扩增 1. 单细胞RNA-seq样本数据说明 样本数据来源文章:Acquired cancer re…

【计算机毕业设计】基于微信小程序的开发项目150套(附源码+演示视频+LW)

大家好!我是程序猿老A,感谢您阅读本文,欢迎一键三连哦。 🧡今天给大家分享200的微信小程序毕业设计,后台用Java开发,这些项目都经过精心挑选,涵盖了不同的实战主题和用例,可做毕业设…

MQ概览及Kafka详解

文章目录 概览MQ优点MQ缺点常见MQ对比JMS消息模型点对点模式发布订阅模式 kafka基础架构发布订阅工作流程生产者生产者文件存储生产者分区策略生产者数据可靠性保证生产者数据一致性保证生产者ack机制ExactlyOnce生产者发送消息流程 消费者消费者分区分配策略消费者消费数据问题…

算法设计与分析实验报告c++实现(TSP问题、哈夫曼编码问题、顾客安排问题、最小生成树问题、图着色问题)

一、实验目的 1.加深学生对贪心算法设计方法的基本思想、基本步骤、基本方法的理解与掌握; 2.提高学生利用课堂所学知识解决实际问题的能力; 3.提高学生综合应用所学知识解决实际问题的能力。 二、实验任务 用贪心算…

streamlit 大模型前段界面

结合 langchain 一起使用的工具,可以显示 web 界面 pip install streamlit duckduckgo-search 运行命令 streamlit run D:\Python_project\NLP\大模型学习\test.py import os from dotenv import load_dotenv from langchain_community.llms import Tongyi load…

matlab学习002-函数及流程控制语句

目录 一,matlab编程基础 1)matlab脚本和函数文件 ①脚本文件 ②函数文件 2)函数的定义和调用 ①定义 ②调用 3)程序流程控制 ①使用for求 122^2……2^622^63之和 ②使用while语句求122^2……2^622^63之和 ③使用matl…

Python学习(三)

函数扩展 多返回值 参数扩展 位置参数 注意:传递的参数和定义的参数的顺序及个数必须一致 关键字参数 关键字名称必须和形参名称相同,形参叫name,那么关键字也要写name 不定长参数 缺省参数

【优选算法专栏】专题十:哈希表(一)

本专栏内容为:算法学习专栏,分为优选算法专栏,贪心算法专栏,动态规划专栏以及递归,搜索与回溯算法专栏四部分。 通过本专栏的深入学习,你可以了解并掌握算法。 💓博主csdn个人主页:小…