2025年 02月 28日 - elasticsearch数据迁移

    elasticsearch数据迁移

    npm install elasticdump -g
    # 导出
    elasticdump \
      --input=http://source-es:9200/my_index \
      --output=/path/to/my_index_mapping.json \
      --type=mapping
    elasticdump \
      --input=http://source-es:9200/my_index \
      --output=/path/to/my_index_data.json \
      --type=data
      
    # 导入
    elasticdump \
      --input=/path/to/my_index_mapping.json \
      --output=http://target-es:9200/my_index \
      --type=mapping
    
    elasticdump \
      --input=/path/to/my_index_data.json \
      --output=http://target-es:9200/my_index \
      --type=data
    

    查看索引可以通过浏览器插件es-client

    2025年 02月 28日 - k8s中安装elasticsearch

    使用helm安装

    helm repo add elastic https://helm.elastic.co
    helm pull elastic/elasticsearch --version 8.8.101
    

    2025年 01月 04日 - 记一次Gitlab迁移

    原有的Gitlab

    概述: 数据目录挂载在外部的/data/server/gitlab/下,主要涉及到的有状态内容为/etc/gitlab 下的配置、/var/log/gitlab下的日志、/var/opt/gitlab下的数据

    过程: 通过备份命令gitlab-rake gitlab:backup:create SKIP=artifacts创建备份, 在新的服务器上拉起Gitlab后进入维护模式并解决了sql的报错与配置文件恢复

    2025年 01月 02日 - 使用python实现简单的web服务

    Python2中的HTTP服务器

    python -m SimpleHTTPServer 8000
    

    Python3中的HTTP服务器

    python -m http.server 8000
    

    2024年 09月 10日 - 在k8s中安装Gitlab runner

    添加helm仓库

    helm repo add gitlab https://charts.gitlab.io
    helm search repo gitlab/gitlab-runner --version 0.42.0
    

    生成values.yaml文件

    helm show values gitlab/gitlab-runner --version 0.42.0 > values.yaml
    

    修改自定义的values.yaml文件内容

    gitlabUrl: 'https://gitlab.xxxx.com/'
    runnerRegistrationToken: 'xxxxx'
    unregisterRunners: true
    concurrent: 2
    checkInterval: 5
    
    
    image:
      registry: registry.gitlab.com
      image: gitlab-org/gitlab-runner
      tag: alpine-v15.1.0
    
    rbac:
      create: true
      rules:
        - apiGroups: [ '' ] #"" indicates the core API group
          resources: [ '*' ]
          verbs: [ '*' ]
        - apiGroups: [ 'networking.k8s.io' ]
          resources: [ 'ingresses' ]
          verbs: [ '*' ]
        - apiGroups: [ 'apps' ]
          resources: [ 'deployments' ]
          verbs: [ '*' ]
      clusterWideAccess: true
      serviceAccountName: gitlab-runner
    
    runners:
      config: |
        [[runners]]
          [runners.kubernetes]
            namespace = "{{.Release.Namespace}}"
            image = "ubuntu:18.04"
          [runners.cache]
            Type = "s3"
            Shared = false
            [runners.cache.s3]
              ServerAddress = "minio.xxx.com"
              # AccessKey = "${S3_ACCESS_KEY}"  # 使用环境变量存储密钥
              # SecretKey = "${S3_SECRET_KEY}"  # 使用环境变量存储密钥
              AccessKey = "xxxx"
              SecretKey = "xxxx"
              BucketName = "gitlab-cache"
              # 如果可能,尽量启用 HTTPS
              Insecure = true
      tags: 'k8s-runner'
      helpers:
        cpuLimit: 200m
        memoryLimit: 256Mi
        cpuRequests: 100m
        memoryRequests: 128Mi
        image: 'registry.gitlab.com/gitlab-runner-helper:arm64-76984217'
      serviceAccountName: gitlab-runner
    
    

    查看模板与自定义配置生成的内容(可选)

    
    # helm template -f values.yaml --namespace gitlab-runner gitlab/gitlab-runner > gitlab-runner.yaml
    
    

    安装或更新

    helm install -f ./values.yaml gitlab-runner gitlab/gitlab-runner -n gitlab-runner --version 0.42.0
    
    helm upgrade -f ./values.yaml gitlab-runner gitlab/gitlab-runner -n gitlab-runner --version 0.42.0
    

    查看部署状态

    helm status gitlab-runner -n gitlab-runner
    

    卸载

    helm delete gitlab-runner -n gitlab-runner