使用docker-compose 一鍵部署你的分散式調用鏈跟蹤框架skywalking

来源:https://www.cnblogs.com/huangxincheng/archive/2018/09/18/9666930.html
-Advertisement-
Play Games

一旦你的程式docker化之後,你會遇到各種問題,比如原來採用的本地記日誌的方式就不再方便了,雖然你可以掛載到宿主機,但你使用 --scale 的話,會導致 記錄日誌異常,所以最好的方式還是要做日誌中心化,另一個問題,原來一個請求在一個進程中的痙攣失敗,你可以在日誌中巡查出調用堆棧,但是docker ...


 

  一旦你的程式docker化之後,你會遇到各種問題,比如原來採用的本地記日誌的方式就不再方便了,雖然你可以掛載到宿主機,但你使用 --scale 的話,會導致

記錄日誌異常,所以最好的方式還是要做日誌中心化,另一個問題,原來一個請求在一個進程中的痙攣失敗,你可以在日誌中巡查出調用堆棧,但是docker化之後,

原來一個進程的東西會拆成幾個微服務,這時候最好就要有一個分散式的調用鏈跟蹤,類似於wcf中的svctraceview工具。

 

一:搭建skywalking

  gihub地址是:https://github.com/apache/incubator-skywalking 從文檔中大概看的出來,大體分三個部分:存儲,收集器,探針,存儲這裡就選用推薦的

elasticsearch。收集器準備和es部署在一起,探針就有各自語言的實現了,總之這裡就有三個docker container: es,kibana,skywalking, 如果不用容器編排工具

的話就比較麻煩。

      下麵是本次搭建的一個目錄結構:

 

1.  elasticsearch.yml

    es的配置文件,不過這裡有一個坑,就是一定要將 network.publish_host: 0.0.0.0 ,否則skywalking會連不上 9300埠。

network.publish_host: 0.0.0.0
transport.tcp.port: 9300
network.host: 0.0.0.0

 

2. elasticsearch.dockerfile

    在up的時候,將這個es文件copy到 容器的config文件夾下。

FROM elasticsearch:5.6.4

EXPOSE 9200 9300

COPY elasticsearch.yml /usr/share/elasticsearch/config/

 

3. application.yml

   skywalking的配置文件,這裡也有一個坑:連接es的地址中,配置的 clustername一定要修改成和es的clustername保持一致,否則會連不上,這裡容器之間用link

進行互聯,所以es的ip改成elasticsearch就可以了,其他的ip改成0.0.0.0 。 

 

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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.

#cluster:
#  zookeeper:
#    hostPort: localhost:2181
#    sessionTimeout: 100000
naming:
  jetty:
    host: 0.0.0.0
    port: 10800
    contextPath: /
cache:
#  guava:
  caffeine:
remote:
  gRPC:
    host: 0.0.0.0
    port: 11800
agent_gRPC:
  gRPC:
    host: 0.0.0.0
    port: 11800
    #Set these two setting to open ssl
    #sslCertChainFile: $path
    #sslPrivateKeyFile: $path

    #Set your own token to active auth
    #authentication: xxxxxx
agent_jetty:
  jetty:
    host: 0.0.0.0
    port: 12800
    contextPath: /
analysis_register:
  default:
analysis_jvm:
  default:
analysis_segment_parser:
  default:
    bufferFilePath: ../buffer/
    bufferOffsetMaxFileSize: 10M
    bufferSegmentMaxFileSize: 500M
    bufferFileCleanWhenRestart: true
ui:
  jetty:
    host: 0.0.0.0
    port: 12800
    contextPath: /
storage:
  elasticsearch:
    clusterName: elasticsearch
    clusterTransportSniffer: true
    clusterNodes: elasticsearch:9300
    indexShardsNumber: 2
    indexReplicasNumber: 0
    highPerformanceMode: true
    ttl: 7
#storage:
#  h2:
#    url: jdbc:h2:~/memorydb
#    userName: sa
configuration:
  default:
#     namespace: xxxxx
# alarm threshold
    applicationApdexThreshold: 2000
    serviceErrorRateThreshold: 10.00
    serviceAverageResponseTimeThreshold: 2000
    instanceErrorRateThreshold: 10.00
    instanceAverageResponseTimeThreshold: 2000
    applicationErrorRateThreshold: 10.00
    applicationAverageResponseTimeThreshold: 2000
# thermodynamic
    thermodynamicResponseTimeStep: 50
    thermodynamicCountOfResponseTimeSteps: 40
View Code

 

4.  skywalking.dockerfile

      接下來就是 skywalking的 下載安裝,使用dockerfile流程化。

FROM centos:7

LABEL username="[email protected]"

WORKDIR /app

RUN yum install -y wget && \
    yum install -y java-1.8.0-openjdk

ADD http://mirrors.hust.edu.cn/apache/incubator/skywalking/5.0.0-RC2/apache-skywalking-apm-incubating-5.0.0-RC2.tar.gz /app

RUN tar -xf apache-skywalking-apm-incubating-5.0.0-RC2.tar.gz && \
    mv apache-skywalking-apm-incubating skywalking

RUN ls /app

#copy文件
COPY application.yml /app/skywalking/config/application.yml

WORKDIR /app/skywalking/bin

USER root

RUN  echo "tail -f /dev/null" >> /app/skywalking/bin/startup.sh

CMD ["/bin/sh","-c","/app/skywalking/bin/startup.sh" ]

 

5. docker-compose.yml

    最後就是將這三個容器進行編排,要註意的是,因為收集器會將數據放入到es中,所有一定要將es的data掛載到宿主機的大硬碟下,否則你的空間會不足的。

version: '3.1'

services:

  #elastic 鏡像
  elasticsearch:
    build:
      context: .
      dockerfile: elasticsearch.dockerfile
    # ports:
    #   - "9200:9200"
    #   - "9300:9300"
    volumes:
       - "/data/es2:/usr/share/elasticsearch/data"

  #kibana 可視化查詢,暴露 5601
  kibana:
    image: kibana
    links:
      - elasticsearch
    ports:
      - 5601:5601
    depends_on:
      - "elasticsearch"
      
  #skywalking
  skywalking:
    build:
      context: .
      dockerfile: skywalking.dockerfile
    ports:
      - "10800:10800"
      - "11800:11800"
      - "12800:12800"
      - "8080:8080"
    links:
      - elasticsearch
    depends_on:
      - "elasticsearch"

 

二:一鍵部署

      要部署在docker中,你還得需要安裝docker-ce 和 docker-compose,大家可以參照官方安裝一下。

 

1. Docker-ce 的安裝

sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine

sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

sudo yum install docker-ce

 

然後啟動一下docker 服務,可以看到版本是18.06.1

[root@localhost ~]# service docker start
Redirecting to /bin/systemctl start  docker.service
[root@localhost ~]# docker -v
Docker version 18.06.1-ce, build e68fc7a

 

2. docker-compose的安裝

sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

 

3.  最後在centos上執行 docker-compopse up --build 就可以了,如果不想terminal上運行,可以加 -d 使用後臺執行。

 

[root@localhost docker]# docker-compose up --build
Creating network "docker_default" with the default driver
Building elasticsearch
Step 1/3 : FROM elasticsearch:5.6.4
 ---> 7a047c21aa48
Step 2/3 : EXPOSE 9200 9300
 ---> Using cache
 ---> 8d66bb57b09d
Step 3/3 : COPY elasticsearch.yml /usr/share/elasticsearch/config/
 ---> Using cache
 ---> 02b516c03b95
Successfully built 02b516c03b95
Successfully tagged docker_elasticsearch:latest
Building skywalking
Step 1/12 : FROM centos:7
 ---> 5182e96772bf
Step 2/12 : LABEL username="[email protected]"
 ---> Using cache
 ---> b95b96a92042
Step 3/12 : WORKDIR /app
 ---> Using cache
 ---> afdf4efe3426
Step 4/12 : RUN yum install -y wget &&     yum install -y java-1.8.0-openjdk
 ---> Using cache
 ---> 46be0ca0f7b5
Step 5/12 : ADD http://mirrors.hust.edu.cn/apache/incubator/skywalking/5.0.0-RC2/apache-skywalking-apm-incubating-5.0.0-RC2.tar.gz /app

 ---> Using cache
 ---> d5c30bcfd5ea
Step 6/12 : RUN tar -xf apache-skywalking-apm-incubating-5.0.0-RC2.tar.gz &&     mv apache-skywalking-apm-incubating skywalking
 ---> Using cache
 ---> 1438d08d18fa
Step 7/12 : RUN ls /app
 ---> Using cache
 ---> b594124672ea
Step 8/12 : COPY application.yml /app/skywalking/config/application.yml
 ---> Using cache
 ---> 10eaf0805a65
Step 9/12 : WORKDIR /app/skywalking/bin
 ---> Using cache
 ---> bc0f02291536
Step 10/12 : USER root
 ---> Using cache
 ---> 4498afca5fe6
Step 11/12 : RUN  echo "tail -f /dev/null" >> /app/skywalking/bin/startup.sh
 ---> Using cache
 ---> 1c4be7c6b32a
Step 12/12 : CMD ["/bin/sh","-c","/app/skywalking/bin/startup.sh" ]
 ---> Using cache
 ---> ecfc97e4c97d
Successfully built ecfc97e4c97d
Successfully tagged docker_skywalking:latest
Creating docker_elasticsearch_1 ... done
Creating docker_skywalking_1    ... done
Creating docker_kibana_1        ... done
Attaching to docker_elasticsearch_1, docker_kibana_1, docker_skywalking_1
elasticsearch_1  | [2018-09-17T23:51:47,611][INFO ][o.e.n.Node               ] [] initializing ...
elasticsearch_1  | [2018-09-17T23:51:47,729][INFO ][o.e.e.NodeEnvironment    ] [FC_bOh1] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda3)]], net usable_space [5gb], net total_space [22.1gb], spins? [possibly], types [xfs]
elasticsearch_1  | [2018-09-17T23:51:47,730][INFO ][o.e.e.NodeEnvironment    ] [FC_bOh1] heap size [1.9gb], compressed ordinary object pointers [true]
elasticsearch_1  | [2018-09-17T23:51:47,731][INFO ][o.e.n.Node               ] node name [FC_bOh1] derived from node ID [FC_bOh1nS_uW6JKy_46iBg]; set [node.name] to override
elasticsearch_1  | [2018-09-17T23:51:47,732][INFO ][o.e.n.Node               ] version[5.6.4], pid[1], build[8bbedf5/2017-10-31T18:55:38.105Z], OS[Linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_151/25.151-b12]
elasticsearch_1  | [2018-09-17T23:51:47,732][INFO ][o.e.n.Node               ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/share/elasticsearch]
skywalking_1     | SkyWalking Collector started successfully!
elasticsearch_1  | [2018-09-17T23:51:49,067][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [aggs-matrix-stats]
elasticsearch_1  | [2018-09-17T23:51:49,067][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [ingest-common]
elasticsearch_1  | [2018-09-17T23:51:49,067][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [lang-expression]
elasticsearch_1  | [2018-09-17T23:51:49,067][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [lang-groovy]
elasticsearch_1  | [2018-09-17T23:51:49,067][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [lang-mustache]
elasticsearch_1  | [2018-09-17T23:51:49,067][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [lang-painless]
elasticsearch_1  | [2018-09-17T23:51:49,067][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [parent-join]
elasticsearch_1  | [2018-09-17T23:51:49,068][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [percolator]
elasticsearch_1  | [2018-09-17T23:51:49,068][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [reindex]
elasticsearch_1  | [2018-09-17T23:51:49,069][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [transport-netty3]
elasticsearch_1  | [2018-09-17T23:51:49,069][INFO ][o.e.p.PluginsService     ] [FC_bOh1] loaded module [transport-netty4]
elasticsearch_1  | [2018-09-17T23:51:49,069][INFO ][o.e.p.PluginsService     ] [FC_bOh1] no plugins loaded
skywalking_1     | SkyWalking Web Application started successfully!
elasticsearch_1  | [2018-09-17T23:51:51,950][INFO ][o.e.d.DiscoveryModule    ] [FC_bOh1] using discovery type [zen]
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["status","plugin:[email protected]","info"],"pid":12,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
elasticsearch_1  | [2018-09-17T23:51:53,456][INFO ][o.e.n.Node               ] initialized
elasticsearch_1  | [2018-09-17T23:51:53,457][INFO ][o.e.n.Node               ] [FC_bOh1] starting ...
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["status","plugin:[email protected]","info"],"pid":12,"state":"yellow","message":"Status changed from uninitialized to yellow - Waiting for Elasticsearch","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["status","plugin:[email protected]","info"],"pid":12,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["error","elasticsearch","admin"],"pid":12,"message":"Request error, retrying\nHEAD http://elasticsearch:9200/ => connect ECONNREFUSED 172.21.0.2:9200"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"No living connections"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["status","plugin:[email protected]","info"],"pid":12,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["status","plugin:[email protected]","error"],"pid":12,"state":"red","message":"Status changed from yellow to red - Unable to connect to Elasticsearch at http://elasticsearch:9200.","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
elasticsearch_1  | [2018-09-17T23:51:53,829][INFO ][o.e.t.TransportService   ] [FC_bOh1] publish_address {172.21.0.2:9300}, bound_addresses {0.0.0.0:9300}
elasticsearch_1  | [2018-09-17T23:51:53,870][INFO ][o.e.b.BootstrapChecks    ] [FC_bOh1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["status","plugin:[email protected]","info"],"pid":12,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["listening","info"],"pid":12,"message":"Server running at http://0.0.0.0:5601"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:53Z","tags":["status","ui settings","error"],"pid":12,"state":"red","message":"Status changed from uninitialized to red - Elasticsearch plugin is red","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:56Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana_1         | {"type":"log","@timestamp":"2018-09-17T23:51:56Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"No living connections"}
elasticsearch_1  | [2018-09-17T23:51:57,094][INFO ][o.e.c.s.ClusterService   ] [FC_bOh1] new_master {FC_bOh1}{FC_bOh1nS_uW6JKy_46iBg}{tNMEW5HYQm6O4aiqpU0uWA}{172.21.0.2}{172.21.0.2:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
elasticsearch_1  | [2018-09-17T23:51:57,129][INFO ][o.e.h.n.Netty4HttpServerTransport] [FC_bOh1] publish_address {172.21.0.2:9200}, bound_addresses {0.0.0.0:9200}
elasticsearch_1  | [2018-09-17T23:51:57,129][INFO ][o.e.n.Node               ] [FC_bOh1] started
elasticsearch_1  | [2018-09-17T23:51:57,157][INFO ][o.e.g.GatewayService     ] [FC_bOh1] recovered [0] indices into cluster_state
elasticsearch_1  | [2018-09-17T23:51:57,368][INFO ][o.e.c.m.MetaDataCreateIndexService] [FC_bOh1] [application_alarm_list_month] creating index, cause [api], templates [], shards [2]/[0], mappings [type]
elasticsearch_1  | [2018-09-17T23:51:57,557][INFO ][o.e.c.r.a.AllocationService] [FC_bOh1] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[application_alarm_list_month][0]] ...]).
elasticsearch_1  | [2018-09-17T23:51:57,685][INFO ][o.e.c.m.MetaDataCreateIndexService] [FC_bOh1] [memory_pool_metric_month] creating index, cause [api], templates [], shards [2]/[0], mappings [type]
elasticsearch_1  | [2018-09-17T23:51:57,742][INFO ][o.e.c.r.a.AllocationService] [FC_bOh1] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[memory_pool_metric_month][0]] ...]).
elasticsearch_1  | [2018-09-17T23:51:57,886][INFO ][o.e.c.m.MetaDataCreateIndexService] [FC_bOh1] [service_metric_day] creating index, cause [api], templates [], shards [2]/[0], mappings [type]
elasticsearch_1  | [2018-09-17T23:51:57,962][INFO ][o.e.c.r.a.AllocationService] [FC_bOh1] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[service_metric_day][0]] ...]).
elasticsearch_1  | [2018-09-17T23:51:58,115][INFO ][o.e.c.m.MetaDataCreateIndexService] [FC_bOh1] [application_metric_hour] creating index, cause [api], templates [], shards [2]/[0], mappings [type]
elasticsearch_1  | [2018-09-17T23:51:58,176][INFO ][o.e.c.r.a.AllocationService] [FC_bOh1] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[application_metric_hour][1]] ...]).
elasticsearch_1  | [2018-09-17T23:51:58,356][INFO ][o.e.c.m.MetaDataCreateIndexService] [FC_bOh1] [application_metric_month] creating index, cause [api], templates [], shards [2]/[0], mappings [type]
elasticsearch_1  | [2018-09-17T23:51:58,437][INFO ][o.e.c.r.a.AllocationService] [FC_bOh1] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[application_metric_month][0]] ...]).
elasticsearch_1  
              
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 數組中有一個數字出現的次數超過數組長度的一半,請找出這個數字。例如輸入一個長度為9的數組{1,2,3,2,2,2,5,4,2}。由於數字2在數組中出現了5次,超過數組長度的一半,因此輸出2。如果不存在則輸出0。 兩種方式: 1.定義一個新數組arr,遍曆數組給arr賦值,arr[元素]=出現的次數 ... ...
  • 已經有兩個月沒有寫博客了,也有好幾個月沒有看go相關的內容了,由於工作原因最近在做java以及大數據相關的內容,導致最近工作較忙,博客停止了更新,正好想撿起之前go的東西,所以找了一個源碼學習 這個也是之前用go寫日誌收集的時候用到的一個包 :github.com/hpcloud/tail, 這次就 ...
  • 目前主要功能是完成知乎視頻的下載. 在抓包和網頁分析發現有blob:https://...格式的視頻鏈接, 但是無法訪問, 不過知乎好像是m3u8格式的, 具體的我也不太清楚, 但這並不妨礙我們的下載工作. 其中ts就是被分割後的相對url, 拼接後就可以下載播放了, 不過這裡還要做的就是將所有被分 ...
  • 比賽鏈接 上紫啦hhh,好開心 每個題裡面都有中文翻譯,我就不說題意了。。 A 直接模擬即可 #include<cstdio> #include<algorithm> #define int long long using namespace std; const int MAXN = 1e5 + ...
  • 先說下我寫這個爬蟲的思路吧:首先是利用selenium模擬瀏覽器,然後搜索貼吧名,如果不存在就提示“沒有找到該貼吧”,然後重新輸入,如果搜到了這個貼吧,就進入該貼吧並且顯示該貼吧首頁上的所有帖子,然後我們可以選擇查看哪一個帖子,程式就會返回該帖子的內容,對於評論較多的帖子,還可以查看下一頁,如果想看 ...
  • 機器語言: 優點: 最底層,所以速度最快! 缺點: 最複雜,所以開發效率低! 彙編語言: 優點: 最底層,所以速度最快! 缺點: 最複雜,所以開發效率低! 高級語言: 1.編譯類: 優點: 語言執行速度快,不依賴語言運行環境! 缺點: 跨平臺差。 2.解釋類: 優點: 跨平臺方便,一份代碼可以到處用 ...
  • 本次爬取用到的知識點有: 1. selenium 2. pymysql 3 pyquery 正文 1. 分析目標網站 1. 打開某寶首頁, 輸入"男裝"後點擊"搜索", 則跳轉到"男裝"的搜索界面. 2. 空白處"右擊"再點擊"檢查"審查網頁元素, 點擊"Network". 1) 找到對應的URL, ...
  • 1. 前言 我們知道,生產者發送消息到主題,消費者訂閱主題(以消費者組的名義訂閱),而主題下是分區,消息是存儲在分區中的,所以事實上生產者發送消息到分區,消費者則從分區讀取消息,那麼,這裡問題來了,生產者將消息投遞到哪個分區?消費者組中的消費者實例之間是怎麼分配分區的呢?接下來,就圍繞著這兩個問題一 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...