{"id":728,"date":"2024-12-20T14:05:00","date_gmt":"2024-12-20T06:05:00","guid":{"rendered":"https:\/\/blog.lijishi.com\/?p=728"},"modified":"2025-02-08T14:13:32","modified_gmt":"2025-02-08T06:13:32","slug":"docker-zabbix","status":"publish","type":"post","link":"https:\/\/blog.lijishi.com\/index.php\/2024\/12\/20\/docker-zabbix\/","title":{"rendered":"Docker | Zabbix \u8fc1\u79fb"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u53ef\u80fd\u4e5f\u662f\u4ece\u8fd9\u4e00\u523b\u8d77\uff0c\u624d\u7a81\u7136\u610f\u8bc6\u5230\u81ea\u5df1\u5df2\u7ecf\u6bd5\u4e1a\u56db\u5e74\u4e86\u2026\u2026<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">\u5927\u5b66\u7684\u65f6\u5019\u8d81\u7740\u5b66\u751f\u7684\u8eab\u4efd\uff0c\u628a\u817e\u8baf\u4e91\u7684\u8f7b\u91cf\u670d\u52a1\u5668\u7eed\u5230\u4e862024\u5e74\u5e95\uff0c\u53ef\u80fd\u572819\u5e74\u7684\u6211\u770b\u8d77\u6765\u662f\u4e00\u4e2a\u975e\u5e38\u9065\u8fdc\u7684\u65f6\u95f4\u70b9\u3002\u4f46\u65f6\u95f4\u771f\u7684\u8fc7\u5f97\u98de\u5feb\uff0c\u4e0d\u81ea\u89c9\u5f97\u5c31\u5df2\u7ecf\u56db\u5e74\u8fc7\u53bb\u4e86\uff0c\u770b\u4e86\u773c\u4ef7\u683c\u662f\u6211\u7eed\u8d39\u4e0d\u8d77\u7684\u4e86\uff0c\u800c\u4e14\u670d\u52a1\u5668\u4e0a\u8dd1\u4e86\u592a\u591a\u6ca1\u7528\u7684\u8fdb\u7a0b\uff0c\u6211\u89c9\u5f97\u4e5f\u662f\u65f6\u5019\u8003\u8651\u6362\u4e00\u53f0\u670d\u52a1\u5668\u4ece\u5934\u6574\u7406\u4e00\u904d\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u670d\u52a1\u5668\u4e0a\u8dd1\u4e86\u5f88\u591a\u4e1c\u897f\uff0c\u6bd4\u5982\u5b9d\u5854\u9762\u677f\uff0c\u6bd4\u5982\u5fae\u8f6f\u7684KMS\u7834\u89e3\u6fc0\u6d3b\u7a0b\u5e8f\uff0c\u6bd4\u5982\u4e00\u4e9b\u7f51\u7ad9\u4ee3\u7406\uff0c\u8fd9\u4e9b\u90fd\u5f88\u5bb9\u6613\u8fc1\u79fb\uff0c\u76f4\u63a5\u5e73\u79fb\u5230\u6211\u7684\u53e6\u4e00\u53f0\u963f\u91cc\u4e91\u7684\u8f7b\u91cf\u670d\u52a1\u5668\u5c31OK\u4e86\uff0c\u7136\u540e\u518dDNS\u6539\u4e0bCNAME\u7684\u4e8b\uff0c\u5df2\u7ecf\u73a9\u7684\u5f88\u6e9c\u4e86\u3002\u7136\u800c\u6700\u4ee4\u6211\u5934\u75bc\u7684\u5c31\u662fzabbix\u7684\u8fc1\u79fb\uff0c\u597d\u5728\u662f\u57fa\u4e8edocker\u90e8\u7f72\u7684\uff0c\u76f8\u5bf9\u800c\u8a00\u8fc1\u79fb\u8d77\u6765\u5df2\u7ecf\u7b97\u662f\u65b9\u4fbf\u5f88\u591a\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u524d\u671f\u5728\u7f51\u4e0a\u67e5\u8d44\u6599\uff0c\u53d1\u73b0\u53ef\u4ee5\u505a\u5230\u8fd1\u4e4e\u65e0\u635f\u7684\u8fc1\u79fb\uff0c\u9996\u5148\u5c31\u662f\u8981\u628a\u5f53\u524dzabbix\u7684\u6570\u636e\u5e93dump\u51fa\u6765\uff0c\u7136\u800c\u6211\u7b2c\u4e00\u6b65\u6211\u5c31\u5361\u4f4f\u4e86\uff0cmysql\u7684root\u5bc6\u7801\u6211\u7ed9\u5fd8\u5f97\u6b7b\u6b7b\u7684\uff0c\u5206\u914d\u7ed9zabbix\u7684\u8d26\u53f7\u6743\u9650\u53c8\u4e0d\u591f\uff0c\u4e8e\u662f\u4e4e\u53c8\u8981\u4ece\u627e\u56demysql\u7684root\u5bc6\u7801\u5f00\u59cb\u505a\u2026\u2026<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u627e\u56de\u5bc6\u7801\u540e\uff0c\u5c31\u662f\u6309\u7167\u7f51\u4e0a\u7684\u6559\u7a0b\uff0c\u5c06\u73b0\u5728\u7684\u7684\u6570\u636e\u5168\u90e8\u5907\u4efd\u51fa\u6765<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqldump -u root -h 172.17.0.2 -p zabbix > \/database_zabbix.sql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\u5c31\u662f\u628azabbix\u7684\u4e09\u4e2a\u7ec4\u4ef6docker\u62c9\u8d77\u6765\uff0c\u5c24\u5176\u662f\u8981\u8d26\u53f7\u5bc6\u7801\u4fe1\u606f\u5bf9\u9f50\u9897\u7c92\u5ea6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run --name zabbix-mysql -d \\\n   -v \/data\/zabbix_mysql\/mysql_data:\/var\/lib\/mysql \\\n      -v \/data\/zabbix_mysql\/mysql_logs:\/var\/log\/mysql \\\n      -v \/data\/zabbix_mysql\/mysql_conf:\/etc\/mysql\/conf.d \\\n      -e MYSQL_DATABASE=\"zabbix\" \\\n      -e MYSQL_USER=\"zabbix\" \\\n      -e MYSQL_PASSWORD=\"zabbix\" \\\n      -e MYSQL_ROOT_PASSWORD=\"zabbix\" \\\n      --network=zabbix-net \\\n      --ip 192.168.100.2 \\\n      -p 3306:3306 \\\n      --restart=unless-stopped \\\n      93f1a2fa0508 \\\n      --character-set-server=utf8 --collation-server=utf8_bin \\\n      --default-authentication-plugin=mysql_native_password\n\ndocker run --name zabbix-server-mysql -d \\\n    -v zabbix_server:\/etc\/zabbix \\\n      -e DB_SERVER_HOST=\"zabbix-mysql\" \\\n      -e MYSQL_DATABASE=\"zabbix\" \\\n      -e MYSQL_USER=\"zabbix\" \\\n      -e MYSQL_PASSWORD=\"zabbix\" \\\n      -e MYSQL_ROOT_PASSWORD=\"zabbix\" \\\n     --network=zabbix-net \\\n      --ip 192.168.100.3 \\\n      --restart=unless-stopped \\\n      -p 10051:10051 \\\n      644ea108848d\n\n\ndocker run --name zabbix-web-nginx-mysql -d \\\n   -e PHP_TZ=\"Asia\/Shanghai\" \\\n   -e ZBX_SERVER_HOST=\"zabbix-server-mysql\" \\\n      -e DB_SERVER_HOST=\"zabbix-mysql\" \\\n      -e MYSQL_DATABASE=\"zabbix\" \\\n      -e MYSQL_USER=\"zabbix\" \\\n      -e MYSQL_PASSWORD=\"zabbix\" \\\n      -e MYSQL_ROOT_PASSWORD=\"zabbix\" \\\n      --network=zabbix-net \\\n      --ip 192.168.100.4 \\\n      -p 8080:8080 \\\n      --restart unless-stopped \\\n      1e5753ca9f8a\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u518d\u628a\u4e4b\u524d\u5907\u4efd\u51fa\u6765\u7684\u6570\u636e\u5bfc\u5165\u56de\u53bb\uff0c\u8fd9\u6b21\u662f\u521a\u521b\u5efa\u5b8c\u7684mysql\uff0croot\u5bc6\u7801\u53ef\u5c31\u4e0d\u80fd\u518d\u5fd8\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root  -h 192.168.100.2 -p zabbix &lt; database_zabbix.sql\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u9759\u5f85\u7247\u523b\uff0c\u6253\u5f00\u9875\u9762\uff0c\u5c31\u53ef\u80fd\u770b\u5230zabbix\u4f9d\u7136\u5982\u521d\u3002\u524d\u6587\u4e4b\u6240\u4ee5\u8bf4\u662f\u8fd1\u4e4e\u65e0\u635f\uff0c\u662f\u56e0\u4e3a\u8fd9\u4e2a\u6570\u636e\u5e93\u5bfc\u5165\u5bfc\u51fa\u7684\u65f6\u95f4\u5dee\u8fd8\u662f\u4f1a\u51fa\u73b0\u65e0\u6cd5\u91c7\u96c6\u6570\u636e\u7684\u60c5\u51b5\uff0c\u4ea7\u751f\u7684\u5f71\u54cd\u53ef\u80fd\u5c31\u4f9d\u8d56\u4e8e\u4f60\u7684\u624b\u901f\u548c\u7f51\u901f\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53ef\u80fd\u4e5f\u662f\u4ece\u8fd9\u4e00\u523b\u8d77\uff0c\u624d\u7a81\u7136\u610f\u8bc6\u5230\u81ea\u5df1\u5df2\u7ecf\u6bd5\u4e1a\u56db\u5e74\u4e86\u2026\u2026 \u5927\u5b66\u7684\u65f6\u5019\u8d81\u7740\u5b66\u751f\u7684\u8eab\u4efd\uff0c\u628a\u817e\u8baf\u4e91\u7684\u8f7b\u91cf\u670d\u52a1\u5668\u7eed\u5230\u4e862 &hellip; <a href=\"https:\/\/blog.lijishi.com\/index.php\/2024\/12\/20\/docker-zabbix\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Docker | Zabbix \u8fc1\u79fb<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":731,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[12,29,53],"class_list":["post-728","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-develop","tag-docker","tag-zabbix","tag-53"],"_links":{"self":[{"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/posts\/728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/comments?post=728"}],"version-history":[{"count":3,"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/posts\/728\/revisions"}],"predecessor-version":[{"id":732,"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/posts\/728\/revisions\/732"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/media\/731"}],"wp:attachment":[{"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/media?parent=728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/categories?post=728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lijishi.com\/index.php\/wp-json\/wp\/v2\/tags?post=728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}