尊龙凯时人生就是搏

ÔõÑùÔÚLinuxÉÏʹÓÃDocker¾ÙÐÐÈÝÆ÷µÄ¼à¿ØºÍÈÕÖ¾ÆÊÎö£¿

ÔõÑùÔÚlinuxÉÏʹÓÃdocker¾ÙÐÐÈÝÆ÷µÄ¼à¿ØºÍÈÕÖ¾ÆÊÎö£¿

СÐò£º

DockerÊÇÒ»ÖÖÊ¢ÐеÄÈÝÆ÷»¯ÊÖÒÕ £¬Ëü¿ÉÒÔÉÁ¿ª·¢Ö°Ô±Ô½·¢ÇáËɵع¹½¨¡¢·Ö·¢ºÍÔËÐÐÓ¦ÓóÌÐò¡£È»¶ø £¬Ëæ×ÅÓ¦ÓóÌÐòÊýÄ¿µÄÔöÌí £¬¶ÔÈÝÆ÷µÄ¼à¿ØºÍÈÕÖ¾ÆÊÎö±äµÃÔ½À´Ô½Ö÷Òª¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxϵͳÉÏʹÓÃDocker¾ÙÐÐÈÝÆ÷µÄ¼à¿ØºÍÈÕÖ¾ÆÊÎö £¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£

Ò»¡¢ÈÝÆ÷¼à¿Ø

ʹÓÃcAdvisor¾ÙÐÐÈÝÆ÷¼à¿Ø

cAdvisorÊÇGoogle¿ªÔ´µÄÈÝÆ÷¼à¿Ø¹¤¾ß £¬¿ÉÒÔÌṩÈÝÆ÷µÄCPU¡¢ÄÚ´æ¡¢ÍøÂçºÍ´ÅÅ̵ȼà¿ØÊý¾Ý¡£ÏÂÃæÊÇʹÓÃcAdvisor¼à¿ØÈÝÆ÷µÄ°ì·¨£º

°ì·¨1£º×°ÖúÍÆô¶¯cAdvisor

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃcAdvisor£º

docker run --detach=true --name=cadvisor --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --publish=8080:8080 gcr.io/cadvisor/cadvisor:latest

µÇ¼ºó¸´ÖÆ

Æô¶¯ºó £¬¿ÉÒÔͨ¹ý»á¼ûhttp://localhost:8080À´Éó²é¼à¿ØÊý¾Ý¡£

°ì·¨2£º¼à¿ØÖ¸¶¨ÈÝÆ÷

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî¼à¿ØÖ¸¶¨ÈÝÆ÷£º

docker run --detach=true --name=cadvisor --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --publish=8080:8080 gcr.io/cadvisor/cadvisor:latest -c docker_container_name

µÇ¼ºó¸´ÖÆ

ÆäÖÐdocker_container_nameÊÇÒª¼à¿ØµÄÈÝÆ÷µÄÃû³Æ¡£

ʹÓÃPrometheusºÍGrafana¾ÙÐÐÈÝÆ÷¼à¿Ø

PrometheusÊÇÒ»ÖÖ»ùÓÚʱ¼äÐòÁеļà¿Øϵͳ £¬¿ÉÒÔÓÃÓÚÈÝÆ÷¼à¿Ø¡£GrafanaÊÇÒ»ÖÖ¿ªÔ´µÄÊý¾Ý¿ÉÊÓ»¯¹¤¾ß £¬¿ÉÒÔ½«PrometheusÊÕÂÞµÄÊý¾Ý¾ÙÐÐչʾºÍÆÊÎö¡£ÒÔÏÂÊÇʹÓÃPrometheusºÍGrafana¾ÙÐÐÈÝÆ÷¼à¿ØµÄ°ì·¨£º

°ì·¨1£º×°ÖúÍÉèÖÃPrometheus

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃPrometheus£º

docker run -d --name=prometheus -p 9090:9090 -v /path/to/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

µÇ¼ºó¸´ÖÆ

ÉèÖÃÎļþprometheus.ymlµÄʾÀýÄÚÈÝÈçÏ£º

global:
  scrape_interval: 15s
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'cadvisor'
    static_configs:
      - targets: ['cadvisor:8080']

µÇ¼ºó¸´ÖÆ

ÔËÐкó £¬¿ÉÒÔͨ¹ý»á¼ûhttp://localhost:9090À´Éó²é¼à¿ØÊý¾Ý¡£

°ì·¨2£º×°ÖúÍÉèÖÃGrafana

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃGrafana£º

docker run -d --name=grafana -p 3000:3000 grafana/grafana

µÇ¼ºó¸´ÖÆ

×°Öúó £¬»á¼ûhttp://localhost:3000À´ÉèÖÃGrafana £¬²¢Ìí¼ÓPrometheusÊý¾ÝÔ´¡£È»ºó¿ÉÒÔ½¨ÉèÒDZíÅÌÀ´Õ¹Ê¾ºÍÆÊÎöÊÕÂÞµÄÊý¾Ý¡£

¶þ¡¢ÈÕÖ¾ÆÊÎö

ʹÓÃELK¾ÙÐÐÈÝÆ÷ÈÕÖ¾ÆÊÎö

ELKÊÇÒ»ÖÖ³£ÓõÄÈÕÖ¾ÆÊÎö½â¾ö¼Æ»® £¬ÓÉElasticsearch¡¢LogstashºÍKibana×é³É¡£ÒÔÏÂÊÇʹÓÃELK¾ÙÐÐÈÝÆ÷ÈÕÖ¾ÆÊÎöµÄ°ì·¨£º

°ì·¨1£º×°ÖúÍÉèÖÃElasticsearch

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃElasticsearch£º

docker run -d --name=elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.15.1

µÇ¼ºó¸´ÖÆ

×°Öúó £¬¿ÉÒÔͨ¹ý»á¼ûhttp://localhost:9200À´ÑéÖ¤ElasticsearchÊÇ·ñÕý³£ÔËÐС£

°ì·¨2£º×°ÖúÍÉèÖÃKibana

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃKibana£º

docker run -d --name=kibana -p 5601:5601 -e "ELASTICSEARCH_HOSTS=http://localhost:9200" docker.elastic.co/kibana/kibana:7.15.1

µÇ¼ºó¸´ÖÆ

×°Öúó £¬¿ÉÒÔͨ¹ý»á¼ûhttp://localhost:5601À´ÉèÖÃKibana £¬²¢Ê¹ÓÃElasticsearch×÷ΪÊý¾ÝÔ´¡£

°ì·¨3£º×°ÖúÍÉèÖÃLogstash

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃLogstash£º

docker run -d --name=logstash -p 5000:5000 -v /path/to/logstash.conf:/usr/share/logstash/pipeline/logstash.conf docker.elastic.co/logstash/logstash:7.15.1

µÇ¼ºó¸´ÖÆ

ÉèÖÃÎļþlogstash.confµÄʾÀýÄÚÈÝÈçÏ£º

input {
  beats {
    port => 5000
  }
}

output {
  elasticsearch {
    hosts => ["http://localhost:9200"]
  }
}

µÇ¼ºó¸´ÖÆ

×°Öúó £¬Logstash½«»á¼àÌý5000¶Ë¿Ú²¢½«ÈÕÖ¾Êý¾Ý·¢Ë͵½Elasticsearch¡£

°ì·¨4£ºÉèÖÃÈÝÆ÷ÈÕÖ¾ÍøÂç

¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÉèÖÃÈÝÆ÷ÈÕÖ¾µÄÍøÂ磺

docker run -it --name=your_container_name --log-driver=gelf --log-opt gelf-address=udp://localhost:5000 your_image_name

µÇ¼ºó¸´ÖÆ

ÆäÖÐyour_container_nameÊÇÒªÍøÂçÈÕÖ¾µÄÈÝÆ÷Ãû³Æ £¬your_image_nameÊÇÈÝÆ÷ËùʹÓõľµÏñÃû³Æ¡£

½áÂÛ£º

ͨ¹ýʹÓÃDocker¾ÙÐÐÈÝÆ÷µÄ¼à¿ØºÍÈÕÖ¾ÆÊÎö £¬ÎÒÃÇ¿ÉÒÔ¸üºÃµØÏàʶÈÝÆ÷µÄÔËÐÐ״̬ºÍÈÕÖ¾ÐÅÏ¢ £¬´Ó¶øÌá¸ßÓ¦ÓóÌÐòµÄÎȹÌÐԺͿɿ¿ÐÔ¡£±¾ÎÄÏÈÈÝÁËÁ½ÖÖ³£ÓõŤ¾ßºÍÒªÁì £¬²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý £¬Ï£Íû¶Ô¶ÁÕßÔÚLinuxϵͳÉÏʹÓÃDocker¾ÙÐÐÈÝÆ÷¼à¿ØºÍÈÕÖ¾ÆÊÎöÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏʹÓÃDocker¾ÙÐÐÈÝÆ÷µÄ¼à¿ØºÍÈÕÖ¾ÆÊÎö£¿µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ