分類: 💻 技術實踐

  • Elasticsearch 研究筆記:從 Solr Edismax 到 NEST 實戰

    研究目標

    1. Elastic 能否做到 Solr 的 Edismax
    2. 達到的情境:根據 List 的算法跟 String 算法是否一致
    3. 權重的分布情況

    Docker 單節點運行指令

    docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "xpack.security.enabled=false" -v es_data:/usr/share/elasticsearch/data elasticsearch:8.17.0

    Docker 集群配置 (docker-compose)

    version: '3'
    services:
      elasticsearch-node1:
        image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
        environment:
          - discovery.type=zen-disco
          - discovery.seed_hosts=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3
          - cluster.initial_master_nodes=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3
          - xpack.security.enabled=false
        volumes:
          - es_data1:/usr/share/elasticsearch/data
        networks:
          - elasticsearch-net
        ports:
          - "9200:9200"
          - "9300:9300"
    
      elasticsearch-node2:
        image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
        environment:
          - discovery.type=zen-disco
          - discovery.seed_hosts=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3
          - cluster.initial_master_nodes=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3
          - xpack.security.enabled=false
        volumes:
          - es_data2:/usr/share/elasticsearch/data
        networks:
          - elasticsearch-net
        ports:
          - "9201:9200"
          - "9301:9300"
    
      elasticsearch-node3:
        image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
        environment:
          - discovery.type=zen-disco
          - discovery.seed_hosts=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3
          - cluster.initial_master_nodes=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3
          - xpack.security.enabled=false
        volumes:
          - es_data3:/usr/share/elasticsearch/data
        networks:
          - elasticsearch-net
        ports:
          - "9202:9200"
          - "9302:9300"
    
    networks:
      elasticsearch-net:
        driver: bridge
    
    volumes:
      es_data1:
      es_data2:
      es_data3:

    啟動集群:

    (閱讀全文…)

  • DB備份還原

    pgsql 備份

    全備份全回朔

    資料備份

    “`bash~
    sudo mkdir -p /opt/backup/idempiere
    sudo chown postgres:postgres /opt/backup/idempiere
    sudo nano /opt/backup/backup_idempiere.sh
    sudo chmod +x /opt/backup/backup_idempiere.sh
    sudo chown postgres:postgres /opt/backup/backup_idempiere.sh

    (閱讀全文…)

  • 資料庫研習文件

    重要觀念

    • Page
    • 資料表的欄位長度
    • Delete的語法
    • IO的速度
    • filegroup跟相對應的disk
    • index的實作是怎麼樣的
    • 語法中的各種lock使用機制
    • 資料表的lock自動跳級
    • 執行計畫

    page

    從 sys.allocation_units 這個表裡面可以找到每個表的page狀態,有分total Page、used page、 data page
    通常 data< used < total

    (閱讀全文…)

  • 分散式資料庫訊息

    重要觀念

    分散式資料庫鎖

    https://www.gushiciku.cn/pl/gkKm/zh-tw

    (閱讀全文…)

  • schemaSpy

    結論

    這套工具可以掃描資料庫來產資料庫文件,But前提是你的DB 表欄位的關聯要做好,其次他產出後的文件並沒有BI需要後續整理,但是以第一步來說,沒問題

    (閱讀全文…)

  • 各家API的比較

    目標們:
    * 91APP
    * cyberbiz
    * EasyStore
    * friday
    * iopenmall
    * MOMO
    * MO+
    * PChome
    * shopify
    * Shopline
    * Yahoo購物中心
    * 樂天
    * 東森
    * 博客來
    * 蝦皮
    * Coupang
    * 露天

    (閱讀全文…)

  • 推薦的V1新算法

    定義參數

    可超接的量 =(設定可超接==null)? 0: (可超接的量有值)?可超接值: 近兩天的訂單中此料號的量總和

    (閱讀全文…)

  • 成本預估故事

    Cost

    所有服務

    服務 VM VCPU Memory size(GB) Hard disk size(GB)
    K8s(Run 69 Pods) 3 16 128 200
    Solr 2 16 16 200
    PostgreSQL 2 16 32 600
    Kafka 3 4 4 80
    ZooKeeper(zk01) 1 16 8 20
    ZooKeeper(zk02,zk03) 2 4 4 20
    Infinispan 2 2 4 20
    HAProxy 2 4 4 20
    Nginx 2 2 4 50
    GitLab 1 8 8 100
    Jenkins 1 2 4 50
    Harbor Registry (IMG Hub) 1 2 2 100
    Elasticsearch 1 8 8 750
    Logstash 1 4 4 20
    Kibana 1 4 8 100
    DNS 1 2 2 16
    MAIL Server 1 4 4 20
    Object Storage (Ceph) 3 4 4 150

    故事

    2021

    5月 我加入精誠,非Oneec身分,但是閒暇時會與Ethan進行相關的討論,並且不時會看SHOPEE跟東森的API文件思考架構
    8月 infra加入精誠,非Oneec身分,但是Ethan已經準備好了技術選型並且請這位Infra整理機器,清理空間
    9月 PM加入精誠 ,Oneec身分,Ethan請她進行思考
    10月 最強的全端RD入場,Oneec身分,Ethan請他跟Infra準備K8S環境底下的高可用環境程式
    12月 還在討論Topic,12月中 全端RD回報,準備好了,開工

    (閱讀全文…)

  • 爬蟲機(OnGCP)

    總結

    需要做的事情
    1. GCP帳號
    2. 開VM
    3. 多台VM 指定一台為母機
    4. 其餘為子機
    5. 安裝DOCKER 並在子母機上設定關聯

    (閱讀全文…)