main
HuangHai 2 months ago
parent a8bbc96700
commit 90ae3ac21e

@ -1,599 +0,0 @@
### 一、系统配置
- 操作系统
$Rocky$ $Linux$ $9.4$
- 修改$IP$地址
```shell
vi /etc/NetworkManager/system-connections/ens192.nmconnection
```
- **重启网络**
```shell
systemctl restart NetworkManager.service
```
- **常用软件安装**
```shell
yum update -y
yum install wget net-tools tar -y
```
- **系统优化**
```xml
vi /etc/systemd/system.conf
# 全局的打开文件数
DefaultLimitNOFILE=2097152
# 全局打开进程数
DefaultLimitNPROC=65535
vi /etc/sysctl.conf
# 全局端口最大的监听队列的长度可为32768
net.core.somaxconn=32768
# 内存分配模式1为不限制
vm.overcommit_memory = 1
# 单进程打开文件句柄数
fs.nr_open = 2097152
# 系统打开文件句柄数
fs.file-max = 2097152
# 大i/o独立部署中间件选配例如redis、队列、数据库等
# 请求连接保存在队列中的最大数目
net.ipv4.tcp_max_syn_backlog=16384
# 网络接口接收数据包比内核处理速率快时,允许送到队列的数据包的最大数目。
net.core.netdev_max_backlog=16384
# 每个tcp连接占用内存共三个值最小字节数 默认值 最大字节数
net.ipv4.tcp_mem = 786432 2097152 3145728
# 每个tcp连接的读缓冲接收缓冲缓存从对端接收的数据后续会被应用程序读取
net.ipv4.tcp_rmem = 2048 32768 4194304
# 每个tcp连接的写缓冲发送缓冲缓存应用程序的数据有序列号被应答确认的数据会从发送缓冲区删除掉
net.ipv4.tcp_wmem = 2048 8192 2097152
```
**添加完成后,刷新内核参数,立即生效:执行命令**
```shell
/sbin/sysctl -p
```
**调整用户组的资源限制**
```xml
vi /etc/security/limits.conf
# 用户会话的 打开文件句柄数
* soft nofile 1048576
* hard nofile 1048576
# 用户会话的 打开进程数限制
* soft nproc 65535
* hard nproc 65535
```
- **需重启生效,检查是否生效**
```
#用户级别的系统配置
ulimit -a
#open file文件限制数
ulimit -n
#进程限制数
ulimit -u
```
- **关闭$SeLinux$**
```
# 临时关闭
setenforce 0
vi /etc/selinux/config
7 SELINUX=enforcing #前面的 7表示文档中第 7 行。方便你查找
7 SELINUX=disabled
```
- **关闭防火墙**
```
#关闭
systemctl stop firewalld
#设置开机不启动
systemctl disable firewalld
```
- **重新启动**
```
reboot
```
### 二、$DataEase$安装
**安装$Docker$**$Docker$ $Compose$
```
yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum makecache
# 安装最新版本Docker
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
# 下载Docker Compose的最新版本
curl -L "https://mirror.ghproxy.com/https://github.com/docker/compose/releases/download/v2.31.0/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose
curl -L "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose
# 赋予执行权限
chmod +x /usr/local/bin/docker-compose
# 验证安装
docker-compose --version
```
**在线安装**
```shell
curl -sSL https://dataease.oss-cn-hangzhou.aliyuncs.com/quick_start_v2.sh | sh
```
**访问办法**
```
- 访问地址 : http://10.10.14.205:8100
- 登录用户名: admin
- 登录密码: DataEase@123456
```
**在线升级**
```shell
dectl upgrade
```
**开发环境版本**
```
dectl version
current version is v2.10.1
```
**安装历史版本**
```shell
wget https://dataease.oss-cn-hangzhou.aliyuncs.com/quick_start_v2.sh
```
**历史版本号**
```
latest_version=$(cat /tmp/de_latest_release)
# 黄海添加的历史版本号
latest_version="v2.10.1"
echo "开始下载 DataEase ${latest_version} 版本在线安装包"
```
**开始安装**
```
chmod +x *.sh
./quick_start_v2.sh
```
### 三、对外暴露数据库端口
> $Q$、如果在线修改数据库中的表,以达到大屏数据直接修改的目的,而且最初的大屏是产品经理使用$Excel$进行模拟数据进行设计的,并不是真正的$Mysql$数据源,能不迁移到$Mysql$数据源就达到这个修改的目标吗,全部迁移到$Mysql$的数据源还有好多工作要做,太麻烦~
$A$:可以采用两个步骤来完成这个目标:
1. **将$Mysql$数据库的$3306$端口暴露出来,让$JAVA$可以连接上**
修改$Mysql$可以使用局域网$IP$访问
```shell
vi /opt/dataease2.0/docker-compose-mysql.yml
```
添加
```
ports:
- "0.0.0.0:3306:3306"
```
$DataEase$自己带的$Mysql$数据库就可以通过宿主机$IP$+$3306$来访问到了。
**重启动**
```shell
/usr/local/bin/dectl restart
```
**数据库用户名与密码**
```shell
root
Password123@mysql
```
**通过修改其中的数据集完成修改工作**
**查询数据表**
```sql
-- 数据源表
-- core_datasource
select * from core_datasource where name like '%岐山%';
-- 数据集组
select * from core_dataset_group where name like '全省人口变化总体趋势预测'; -- id=1033797259734683648
-- 数据集表
select table_name from core_dataset_table where dataset_group_id='1034544942506184704';
-- 查询或者修改
select * from `excel_人口变化趋势_e1c9395feb`
```
更详细的见项目代码。
> **$Q$:我想在主页面显示云南省的地图然后点击地图中某个城市比如昆明市进打开一个新的页面里面是昆明市的地图如果点击的是楚雄州打开的新的页面就是楚雄州的地图并且要求不能开发16个市州的页面那样太麻烦了我只想开发一个市州的页面让第一页省地图将参数传递到市州的页面完成类似于钻取的工作可以吗**
$A$: 目前的$DataEase$ $V2$版本支持外部参数向仪表盘类组件传递参数,但对于地图是不支持的,地图是哪个地区,必然在页面上指定:
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411010759402.png)
这样一来,上面的需求就无法满足了。
只好继续使用黑科技!
找到记录某个大屏使用了哪表记录上面的地区信息:
```sql
select * from data_visualization_info where name ='黄海测试的市州地图';
-- 1049327041104711680 黄海测试的市州地图
-- 配置值
select * from core_chart_view where scene_id=1049327041104711680 and type='map';
```
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411010801598.png)
返回的字段$custom\_attr$中有是哪个地区的配置信息:
```json
"map":{"level":"city","id":"156532300"}
```
很明显
```json
level:[province,city,district]
156530102:五华区
156530100:昆明市
```
上$baidu$查找了一下,$DataEase$中区划表执行的是:
**[2023年省市县行政区划名称及编码对照表、最新省市区表](https://blog.csdn.net/isworking/article/details/128630487)**
由于本次项目只是云南省的市/州就可以了,所以我们只需要找出下面的数据即可:
```sql
DROP TABLE IF EXISTS `t_city_code`;
CREATE TABLE `t_city_code` (
`area_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '地区行政区划码',
`area_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '地区名'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_city_code
-- ----------------------------
INSERT INTO `t_city_code` VALUES ('156530100', '昆明市');
INSERT INTO `t_city_code` VALUES ('156530300', '曲靖市');
INSERT INTO `t_city_code` VALUES ('156530400', '玉溪市');
INSERT INTO `t_city_code` VALUES ('156530500', '保山市');
INSERT INTO `t_city_code` VALUES ('156530600', '昭通市');
INSERT INTO `t_city_code` VALUES ('156530700', '丽江市');
INSERT INTO `t_city_code` VALUES ('156530800', '普洱市');
INSERT INTO `t_city_code` VALUES ('156530900', '临沧市');
INSERT INTO `t_city_code` VALUES ('156532300', '楚雄彝族自治州');
INSERT INTO `t_city_code` VALUES ('156532500', '红河哈尼族彝族自治州');
INSERT INTO `t_city_code` VALUES ('156532600', '文山壮族苗族自治州');
INSERT INTO `t_city_code` VALUES ('156532800', '西双版纳傣族自治州');
INSERT INTO `t_city_code` VALUES ('156532900', '大理白族自治州');
INSERT INTO `t_city_code` VALUES ('156533100', '德宏傣族景颇族自治州');
INSERT INTO `t_city_code` VALUES ('156533300', '怒江傈僳族自治州');
INSERT INTO `t_city_code` VALUES ('156533400', '迪庆藏族自治州');
```
### 四、外部参数的处理办法
https://www.jianshu.com/p/cc9982e986f5
1、省通过跳转设备 转到JAVA接口填写如下
http://10.10.21.20:9000/dsBase/dataease/route?city_name=[city_name]
其中[city_name]是在省地图上显示的热力数据比如GDP=10000等
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411010919859.png)
```java
// http://10.10.21.20:9000/dsBase/dataease/route?city_name=昆明市
// http://10.10.21.20:9000/dsBase/dataease/route?city_name=楚雄彝族自治州
// http://10.10.21.20:9000/dsBase/dataease/route?city_name=西双版纳傣族自治州
// !!!必须发布后访问才能做到进入此接口,否则浏览器就走缓存,不进来这个接口了!!!
/**
* 路由跳转
*
* @param city_name 城市名称
*/
@Before({GET.class})
@EmptyInterface({"city_name"})
public void route(String city_name) {
//大屏名称
String dataVisualizationName = BaseApplication.PropKit.get("dataEase.dataVisualizationName");
//发布的地址
String publish_url = BaseApplication.PropKit.get("dataEase.publish_url");
//先更新一下数据表
dm.updateCity(dataVisualizationName, city_name);
//再拼接一下URL的最终地址
JSONObject jo = new JSONObject();
jo.put("city_name", city_name);
String base64Str = Base64.encode(jo.toString());
//跳转
redirect(publish_url + "/#/de-link/zud8IQ8J?attachParams=" + base64Str);
}
```
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411010921229.png)
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411010921376.png)
### 五、连接远程数据库
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411011315540.png)
**华为云部署主机的账号**
```
117.78.60.214
52025
root
DsIdeal@123
```
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411011316246.png)
```
# 数据库用户名和密码
username: root
password: Password123@mysql
```
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202411011316944.png)
### 六、备份与还原
经反复实验,发现最好的备份还原方法是:
- **使用$Navicat$ $Prenium$备份还原数据库**
- **手动备份还原图片**
**图片的位置**
```
/opt/dataease2.0/data/static-resource
yum install zip -y
zip -r /usr/local/static-resource.zip /opt/dataease2.0/data/static-resource
sz /usr/local/static-resource.zip
```
### 七、集成$Nginx$发布【非必须】
#### 1、$80$端口发布
##### 拉取
```shell
docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openresty/openresty:1.25.3.1-5-alpine-fat
```
##### 打标
```shell
docker tag swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openresty/openresty:1.25.3.1-5-alpine-fat docker.io/openresty/openresty:1.25.3.1-5-alpine-fat
```
##### 编辑 $nginx.conf$
```shell
vi /root/nginx.conf
```
```apl
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# DataEase 所在机器的IP
upstream dataease {
server 10.10.14.203:8100;
}
# 配置日志位置
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
# 监听端口
listen 80;
# 监听域名修改为你自己的域名且域名与nginx所在服务器的IP绑定
#server_name dataease.test.com;
location / {
client_max_body_size 600m;
client_body_buffer_size 128k;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_pass http://dataease;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
```
##### 运行
```shell
mkdir /root/nginx_logs
docker run --name openresty -d -v /root/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf -v /root/nginx_logs:/var/log/nginx -p 80:80 openresty/openresty:1.25.3.1-5-alpine-fat
```
#### 2、用$/dataease/$发布
> 参考:[DataEase v2 设置动态访问路径,使用 Nginx 路径代理 - FIT2CLOUD 知识库](https://kb.fit2cloud.com/?p=57a47d64-4eda-4ae8-a0b0-4329e57b13ff)
**步骤1**
```shell
vi /opt/dataease2.0/conf/application.yml
```
```yaml
server:
servlet:
context-path: /dataease
```
**步骤2**
```shell
echo 'DE_CONTEXT_PATH=/dataease' >> /opt/dataease2.0/.env
```
### 八、离线更新
**下载软件**
```shell
https://community.fit2cloud.com/#/products/dataease/downloads
```
**进入目录**
```shell
tar -xvzf dataease-offline-installer-v2.10.3-ce.tar.gz
cd dataease-offline-installer-v2.10.3-ce
```
**运行脚本**
```shell
/bin/bash install.sh
```
**查看状态**
```shell
dectl status
```
修改$Mysql$可以使用局域网$IP$访问
```shell
vi /opt/dataease2.0/docker-compose-mysql.yml
```
添加
```
ports:
- "0.0.0.0:3306:3306"
```
**重新加载容器**
```shell
dectl reload
```

@ -1,134 +0,0 @@
> Linux 一键部署包安装
> https://www.etlcloud.cn/helpDocument.html?id=648ac032c5ccee14c6641a94
> 安装包下载
> https://www.etlcloud.cn/download.html?type=5&categoryId=6371e5004071f26ef2416667
### 一、前期准备
#### 操作系统
```shell
RockyLinux 9.4
```
#### 查看$SeLinux$状态
```shell
sestatus
```
```
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 33
```
#### 关闭$Selinux$
```shell
grubby --update-kernel ALL --args selinux=0
```
#### 关闭防火墙
```shell
systemctl disable firewalld.service
systemctl stop firewalld
# 检查防火墙状态:
systemctl status firewalld
```
#### 阿里云源加速
```shell
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.sdu.edu.cn/rocky|g' \
-i.bak \
/etc/yum.repos.d/rocky-extras.repo \
/etc/yum.repos.d/rocky.repo
dnf makecache
```
#### 重启生效
```shell
reboot
```
```shell
[root@etl ~]# sestatus
SELinux status: disabled
```
### 二、下载安装包
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202410231617978.png)![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202410231617503.png)
#### 开始安装
```shell
yum install -y unzip lrzsz wget make
mkdir /usr/restcloud -p
cd /usr/restcloud
rz -be 上传
restcloud3.7.zip
unzip restcloud3.7.zip
cd restcloud_V3.7/
# 安装依赖包
wget https://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-3.el8.x86_64.rpm
rpm -ivh compat-openssl10-1.0.2o-3.el8.x86_64.rpm
# 执行安装包
chmod +x restcloud_install.sh
./restcloud_install.sh
```
#### 访问地址
```
http://10.10.14.214:8080/restcloud/admin/login
外网访问地址映射http://www.hzkjai.com:27004/restcloud/admin/login
用户名密码:
admin
pass
```
#### 添加授权
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202410240746944.png)
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202410240746165.png)
#### 重启$Tomcat$
```
ps -aux |grep tomcat //查看tomcat进程
kill -9 进程id //终止进程
cd /usr/tomcat/bin //进入tomcat/bin目录
./startup.sh && tail -f ../logs/catalina.out //启动tomcat并打印启动日志
```
Loading…
Cancel
Save