0%

本地 apt 源服务器部署

  • 安装 apt-mirrornginx

    1
    2
    
    apt update
    apt install apt-mirror nginx -y
  • 创建数据目录

    1
    2
    
    mkdir -p /data/apt-mirror
    chwon -R apt-mirror:apt-mirror /data/apt-mirror
  • 配置 apt-mirror

    vim /etc/apt/mirror.list

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    
    ############ 基础配置 ############
    set base_path    /data/apt-mirror
    set nthreads     15
    set _tilde 0
    
    ############ Ubuntu 20.04 (focal) ############
    # amd64
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    
    # arm64
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    
    
    ############ Ubuntu 22.04 (jammy) ############
    # amd64
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
    
    # arm64
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
    
    
    ############ Ubuntu 24.04 (noble) ############
    # amd64
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
    deb [arch=amd64] https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
    
    # arm64
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
    deb [arch=arm64] https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
    
    
    ############ 清理 ############
    clean https://mirrors.aliyun.com/ubuntu/

    说明:

创建目录

1
mkdir /data/docker/monitor/{alertmanager,grafana,prometheus}

创建配置文件

  • prometheus.yml

    vim /data/docker/monitor/prometheus/prometheus.yml

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    global:
      scrape_interval: 15s
      evaluation_interval: 15s
    
    scrape_configs:
      - job_name: 'prometheus'
        static_configs:
          - targets: ['localhost:9090']
    
      - job_name: "redis"
        static_configs:
          - targets: [192.168.1.100:9121]
    
    alerting:
      alertmanagers:
        - static_configs:
            - targets:
                - alertmanager:9093
    
    rule_files:
      - "/etc/prometheus/rules/*.yml"
  • alertmanager.yml

简介

SQLynx 是一款专业的数据库管理平台,支持SQL查询、表管理、数据导出、数据导入、数据传输、样本数据生成、SQL文件执行、表DDL比较备份和恢复等。

部署

部署docker 和 docker-compose

创建 docker-compose.yml 文件

mkdir /data/sqlynx/{data,log}

vim /data/sqlynx/docker-compose.yml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
services:
  sqlynx:
    image: registry.cn-hangzhou.aliyuncs.com/sql_studio/sqlynx:3.7.0
    container_name: sqlynx
    restart: always
    ports: 
      - "18888:18888"
    volumes:
      - /data/sqlynx/log:/apps/usr/sqlstudio/linux/log
      - /data/sqlynx/data:/apps/usr/sqlstudio/linux/data

docker compose up -d

编译安装 Tengine 3.1.0

  • 安装依赖

    1
    2
    3
    4
    5
    
    # CentOS
    yum install -y jemalloc jemalloc-devel zlib zlib-devel
    
    # Ubuntu
    apt install -y libjemalloc-dev zlib1g-dev libpcre3 libpcre3-dev
  • 编译

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    ./configure \
    --prefix=/usr/local/tengine \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --pid-path=/run/nginx.pid \
    --user=nginx \
    --group=nginx \
    --with-http_ssl_module \
    --with-pcre-jit \
    --with-pcre \
    --with-http_v2_module \
    --with-http_realip_module \
    --with-http_stub_status_module \
    --with-stream \
    --with-stream_ssl_module \
    --with-stream_ssl_preread_module \
    --with-stream_sni \
    --with-jemalloc \
    --with-file-aio \
    --with-threads \
    --with-compat \
    --with-ipv6 \
    --with-http_auth_request_module \
    --with-http_dav_module \
    --add-module=./modules/ngx_http_upstream_dynamic_module \
    --add-module=./modules/ngx_http_upstream_dyups_module \
    --add-module=./modules/ngx_http_upstream_check_module
    
    make && make install

一、环境

主机名OSIP
skywalking01CentOS7192.168.1.101
skywalking02CentOS7192.168.1.102
skywalking03CentOS7192.168.1.103

二、安装 JDK 环境

在三个节点上安装 JDK 21

三、部署 consul 集群

四、部署 ElasticSearch 集群

五、部署 skywalking

5.1 下载解压安装包

1
2
3
wget https://mirrors.tuna.tsinghua.edu.cn/apache/skywalking/10.2.0/apache-skywalking-apm-10.2.0.tar.gz

tar xf apache-skywalking-apm-10.2.0.tar.gz -C /data/

5.2 修改启动脚本

vim /data/apache-skywalking-apm-10.2.0/bin/oapService.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
PRG="$0"
PRGDIR=$(dirname "$PRG")
[ -z "$OAP_HOME" ] && OAP_HOME=$(cd "$PRGDIR/.." > /dev/null || exit 1; pwd)

OAP_LOG_DIR="${OAP_LOG_DIR:-${OAP_HOME}/logs}"
JAVA_OPTS="${JAVA_OPTS:-  -Xms256M -Xmx4096M}"

if [ ! -d "${OAP_LOG_DIR}" ]; then
    mkdir -p "${OAP_LOG_DIR}"
fi

_RUNJAVA=${JAVA_HOME}/bin/java
[ -z "$JAVA_HOME" ] && _RUNJAVA=java

if [ -z "$CLASSPATH" ]; then
  CLASSPATH="$OAP_HOME/config"
else
  CLASSPATH="$OAP_HOME/config:$CLASSPATH"
fi

for i in "$OAP_HOME"/oap-libs/*.jar
do
    CLASSPATH="$i:$CLASSPATH"
done

OAP_OPTIONS=" -Doap.logDir=${OAP_LOG_DIR}"

eval exec "$_RUNJAVA" ${JAVA_OPTS} ${OAP_OPTIONS} -classpath "$CLASSPATH" org.apache.skywalking.oap.server.starter.OAPServerStartUp >> "${OAP_LOG_DIR}/oap.log"

vim /data/apache-skywalking-apm-10.2.0/bin/webappService.sh

一、安装 google-chrome

  • 添加 yum 源

    1
    2
    3
    4
    5
    6
    
    [google64]
    name=Google - x86_64
    baseurl=http://dl.google.com/linux/rpm/stable/x86_64
    enabled=1
    gpgcheck=1
    gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
  • 安装

    1
    2
    3
    4
    5
    
    # 下载 rpm 包
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
    
    # 直接安装
    yum install google-chrome-stable

二、安装 chromedriver

https://chromedriver.storage.googleapis.com/index.html 下载对应版本的驱动

一、备份

创建索引备份仓库 -> 备份索引快照到仓库 -> 查询索引备份仓库中快照列表 -> 从备份快照中恢复索引

三个概念:仓库(repository)、快照(snapshot)、索引(index)

一、备份

  • 生成快照

    1
    2
    
    # etcdctl snapshot save <FILENAME>
    etcdctl snapshot save etcd-snapshot.db

二、恢复

2.1 停止所有节点的 ETCD 服务,并删除数据目录

1
2
3
systemctl stop etcd

rm -rf /data/etcd/*

2.2 在所有节点上恢复数据

1
2
3
4
5
etcdctl snapshot restore etcd-snapshot.db --name etcd01 --data-dir=/data/etcd initial-cluster=etcd01=http://172.20.10.129:2380,etcd02=http://172.20.10.132:2380,etcd03=http://172.20.10.134:2380 initial-advertise-peer-urls=http://172.20.10.129:2380

etcdctl snapshot restore etcd-snapshot.db --name etcd02 --data-dir=/data/etcd initial-cluster=etcd01=http://172.20.10.129:2380,etcd02=http://172.20.10.132:2380,etcd03=http://172.20.10.134:2380 initial-advertise-peer-urls=http://172.20.10.132:2380

etcdctl snapshot restore etcd-snapshot.db --name etcd03 --data-dir=/data/etcd initial-cluster=etcd01=http://172.20.10.129:2380,etcd02=http://172.20.10.132:2380,etcd03=http://172.20.10.134:2380 initial-advertise-peer-urls=http://172.20.10.134:2380

2.3 重启所有节点的 ETCD 服务

1
systemctl start etcd