{"id":3610,"date":"2021-08-03T16:00:35","date_gmt":"2021-08-03T08:00:35","guid":{"rendered":"https:\/\/wyxxt.org.cn\/?p=3610"},"modified":"2023-12-04T14:51:37","modified_gmt":"2023-12-04T06:51:37","slug":"%e7%bd%91%e5%85%b3","status":"publish","type":"post","link":"https:\/\/wyxxt.org.cn\/?p=3610","title":{"rendered":"\u7f51\u5173"},"content":{"rendered":"<h2>\u6d41\u91cf\u7f51\u5173\u548c\u4e1a\u52a1\u7f51\u5173<\/h2>\n<h3>\u6d41\u91cf\u7f51\u5173<\/h3>\n<ul>\n<li>\u5168\u5c40\u6027\u6d41\u63a7<\/li>\n<li>\u65e5\u5fd7\u7edf\u8ba1<\/li>\n<li>\u9632\u6b62 SQL \u6ce8\u5165<\/li>\n<li>\u9632\u6b62 Web \u653b\u51fb<\/li>\n<li>\u5c4f\u853d\u5de5\u5177\u626b\u63cf<\/li>\n<li>\u9ed1\u767d\u540d\u5355\u63a7\u5236<\/li>\n<\/ul>\n<h3><strong>\u4e1a\u52a1\u7f51\u5173<\/strong><\/h3>\n<ul>\n<li>\u8bf7\u6c42\u63a5\u5165\uff1a\u4f5c\u4e3a\u6240\u6709 API \u63a5\u53e3\u670d\u52a1\u8bf7\u6c42\u7684\u63a5\u5165\u70b9\uff0c\u7ba1\u7406\u6240\u6709\u7684\u63a5\u5165\u8bf7\u6c42\uff1b<\/li>\n<li>\u4e1a\u52a1\u805a\u5408\uff1a\u4f5c\u4e3a\u6240\u6709\u540e\u7aef\u4e1a\u52a1\u670d\u52a1\u7684\u805a\u5408\u70b9\uff0c\u6240\u6709\u7684\u4e1a\u52a1\u670d\u52a1\u90fd\u53ef\u4ee5\u5728\u8fd9\u91cc\u88ab\u8c03\u7528\uff1b<\/li>\n<li>\u4e2d\u4ecb\u7b56\u7565\uff1a\u5b9e\u73b0\u5b89\u5168\u3001\u9a8c\u8bc1\u3001\u8def\u7531\u3001\u8fc7\u6ee4\u3001\u6d41\u63a7\uff0c\u7f13\u5b58\u7b49\u7b56\u7565\uff0c\u8fdb\u884c\u4e00\u4e9b\u5fc5\u8981\u7684\u4e2d\u4ecb\u5904\u7406\uff1b<\/li>\n<li>\u7edf\u4e00\u7ba1\u7406\uff1a\u63d0\u4f9b\u914d\u7f6e\u7ba1\u7406\u5de5\u5177\uff0c\u5bf9\u6240\u6709 API \u670d\u52a1\u7684\u8c03\u7528\u751f\u547d\u5468\u671f\u548c\u76f8\u5e94\u7684\u4e2d\u4ecb\u7b56\u7565\u8fdb\u884c\u7edf\u4e00\u7ba1\u7406\u3002<\/li>\n<\/ul>\n<h2>\u5f00\u6e90\u7f51\u5173<\/h2>\n<p>\u76ee\u524d\u5e38\u89c1\u7684\u5f00\u6e90\u7f51\u5173\u5927\u81f4\u4e0a\u6309\u7167\u8bed\u8a00\u5206\u7c7b\u6709\u5982\u4e0b\u51e0\u7c7b\uff1a<\/p>\n<ul>\n<li>Nginx+lua\uff1aOpen Resty\u3001Kong\u3001Orange\u3001Abtesting gateway \u7b49<\/li>\n<li>Java\uff1aZuul\/Zuul2\u3001Spring Cloud Gateway\u3001Kaazing KWG\u3001gravitee\u3001Dromara soul \u7b49<\/li>\n<li>Go\uff1aJanus\u3001fagongzi\u3001Grpc-gateway<\/li>\n<li>Dotnet\uff1aOcelot<\/li>\n<li>NodeJS\uff1aExpress Gateway\u3001Micro Gateway<\/li>\n<\/ul>\n<p>\u6309\u7167\u4f7f\u7528\u6570\u91cf\u3001\u6210\u719f\u5ea6\u7b49\u6765\u5212\u5206\uff0c\u4e3b\u6d41\u7684\u6709 4 \u4e2a\uff1a<\/p>\n<ul>\n<li>OpenResty<\/li>\n<li>Kong<\/li>\n<li>Zuul\/Zuul2<\/li>\n<li>Spring Cloud Gateway<\/li>\n<\/ul>\n<h3>ABTesingGateway<\/h3>\n<p>\u9879\u76ee\u5730\u5740\uff1a<\/p>\n<p>https:\/\/github.com\/CNSRE\/ABTestingGateway<\/p>\n<h3><strong>Zuul\/Zuul2<\/strong><\/h3>\n<p>https:\/\/github.com\/Netflix\/zuul<\/p>\n<h3>Spring Cloud Gateway<\/h3>\n<p>https:\/\/github.com\/spring-cloud\/spring-cloud-gateway\/<\/p>\n<h2><strong>OpenResty\/Kong\/Zuul2\/SpringCloudGateway \u91cd\u8981\u7279\u6027\u5bf9\u6bd4<\/strong><\/h2>\n<table>\n<thead>\n<tr>\n<th>\u7f51\u5173<\/th>\n<th>\u9650\u6d41<\/th>\n<th>\u9274\u6743<\/th>\n<th>\u76d1\u63a7<\/th>\n<th>\u6613\u7528\u6027<\/th>\n<th>\u53ef\u7ef4\u62a4\u6027<\/th>\n<th>\u6210\u719f\u5ea6<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Spring Cloud Gateway<\/td>\n<td>\u53ef\u4ee5\u901a\u8fc7IP\uff0c\u7528\u6237\uff0c\u96c6\u7fa4\u9650\u6d41\uff0c\u63d0\u4f9b\u4e86\u76f8\u5e94\u7684\u63a5\u53e3\u8fdb\u884c\u6269\u5c55<\/td>\n<td>\u666e\u901a\u9274\u6743\u3001auth2.0<\/td>\n<td>Gateway Metrics Filter<\/td>\n<td>\u7b80\u5355\u6613\u7528<\/td>\n<td>spring\u7cfb\u5217\u53ef\u6269\u5c55\u5f3a\uff0c\u6613\u914d\u7f6e \u53ef\u7ef4\u62a4\u6027\u597d<\/td>\n<td>spring\u793e\u533a\u6210\u719f\uff0c\u4f46gateway\u8d44\u6e90\u8f83\u5c11<\/td>\n<\/tr>\n<tr>\n<td>Zuul2<\/td>\n<td>\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u96c6\u7fa4\u9650\u6d41\u548c\u5355\u670d\u52a1\u5668\u9650\u6d41\u4ea6\u53ef\u901a\u8fc7filter\u5b9e\u73b0\u9650\u6d41\u6269\u5c55<\/td>\n<td>filter\u4e2d\u5b9e\u73b0<\/td>\n<td>filter\u4e2d\u5b9e\u73b0<\/td>\n<td>\u53c2\u8003\u8d44\u6599\u8f83\u5c11<\/td>\n<td>\u53ef\u7ef4\u62a4\u6027\u8f83\u5dee<\/td>\n<td>\u5f00\u6e90\u4e0d\u4e45\uff0c\u8d44\u6599\u5c11<\/td>\n<\/tr>\n<tr>\n<td>OpenResty<\/td>\n<td>\u9700\u8981lua\u5f00\u53d1<\/td>\n<td>\u9700\u8981lua\u5f00\u53d1<\/td>\n<td>\u9700\u8981\u5f00\u53d1<\/td>\n<td>\u7b80\u5355\u6613\u7528\uff0c\u4f46\u662f\u9700\u8981\u8fdb\u884c\u7684lua\u5f00\u53d1\u5f88\u591a<\/td>\n<td>\u53ef\u7ef4\u62a4\u6027\u8f83\u5dee\uff0c\u5c06\u6765\u9700\u8981\u7ef4\u62a4\u5927\u91cflua\u811a\u672c<\/td>\n<td>\u5f88\u6210\u719f\u8d44\u6599\u5f88\u591a<\/td>\n<\/tr>\n<tr>\n<td>Kong<\/td>\n<td>\u6839\u636e\u79d2\uff0c\u5206\uff0c\u65f6\uff0c\u5929\uff0c\u6708\uff0c\u5e74\uff0c\u6839\u636e\u7528\u6237\u8fdb\u884c\u9650\u6d41\u3002\u53ef\u5728\u539f\u7801\u7684\u57fa\u7840\u4e0a\u8fdb\u884c\u5f00\u53d1<\/td>\n<td>\u666e\u901a\u9274\u6743\uff0cKey Auth\u9274\u6743\uff0cHMAC\uff0cauth2.0<\/td>\n<td>\u53ef\u4e0a\u62a5datadog\uff0c\u8bb0\u5f55\u8bf7\u6c42\u6570\u91cf\uff0c\u8bf7\u6c42\u6570\u636e\u91cf\uff0c\u5e94\u7b54\u6570\u636e\u91cf\uff0c\u63a5\u6536\u4e8e\u53d1\u9001\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u72b6\u6001\u7801\u6570\u91cf\uff0ckong\u5185\u8fd0\u884c\u65f6\u95f4<\/td>\n<td>\u7b80\u5355\u6613\u7528\uff0capi\u8f6c\u53d1\u901a\u8fc7\u7ba1\u7406\u5458\u63a5\u53e3\u914d\u7f6e\uff0c\u5f00\u53d1\u9700\u8981lua\u811a\u672c<\/td>\n<td>\u53ef\u7ef4\u62a4\u6027\u8f83\u5dee\uff0c\u5c06\u6765\u9700\u8981\u7ef4\u62a4\u5927\u91cflua\u5e93<\/td>\n<td>\u76f8\u5bf9\u6210\u719f\uff0c\u7528\u6237\u95ee\u9898\u6c47\u603b\uff0c\u793e\u533a\uff0c\u63d2\u4ef6\u5f00\u6e90<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Kong<\/h2>\n<p>https:\/\/konghq.com\/<\/p>\n<p>https:\/\/github.com\/kong\/kong<\/p>\n<p><strong>\u4e3b\u8981\u6709\u4e09\u4e2a\u7ec4\u4ef6<\/strong><\/p>\n<ul>\n<li>Kong Server \uff1a\u57fa\u4e8enginx\u7684\u670d\u52a1\u5668\uff0c\u7528\u6765\u63a5\u6536API\u8bf7\u6c42\u3002<\/li>\n<li>Apache Cassandra\/PostgreSQL \uff1a\u7528\u6765\u5b58\u50a8\u64cd\u4f5c\u6570\u636e\u3002<\/li>\n<li>Kong dashboard\uff1a\u5b98\u65b9\u63a8\u8350UI\u7ba1\u7406\u5de5\u5177\uff0c\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 restfull \u65b9\u5f0f \u7ba1\u7406admin api\u3002<\/li>\n<\/ul>\n<p>Kong\u91c7\u7528\u63d2\u4ef6\u673a\u5236\u8fdb\u884c\u529f\u80fd\u5b9a\u5236\uff0c\u63d2\u4ef6\u96c6\uff08\u53ef\u4ee5\u662f0\u6216N\u4e2a\uff09\u5728API\u8bf7\u6c42\u54cd\u5e94\u5faa\u73af\u7684\u751f\u547d\u5468\u671f\u4e2d\u88ab\u6267\u884c\u3002\u63d2\u4ef6\u4f7f\u7528Lua\u7f16\u5199\uff0c\u76ee\u524d\u5df2\u6709\u51e0\u4e2a\u57fa\u7840\u529f\u80fd\uff1aHTTP\u57fa\u672c\u8ba4\u8bc1\u3001\u5bc6\u94a5\u8ba4\u8bc1\u3001CORS\uff08Cross-Origin Resource Sharing\uff0c\u8de8\u57df\u8d44\u6e90\u5171\u4eab\uff09\u3001TCP\u3001UDP\u3001\u6587\u4ef6\u65e5\u5fd7\u3001API\u8bf7\u6c42\u9650\u6d41\u3001\u8bf7\u6c42\u8f6c\u53d1\u4ee5\u53caNginx\u76d1\u63a7\u3002<\/p>\n<h3>\u5b89\u88c5<\/h3>\n<p>\u5b89\u88c5\u73af\u5883\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">#\u83b7\u53d6\u4e0b\u8f7d\u7684rpm\nyum install https:\/\/download.postgresql.org\/pub\/repos\/yum\/9.5\/redhat\/rhel-7-x86_64\/pgdg-centos95-9.5-3.noarch.rpm\n#\u6267\u884c\u5b89\u88c5\nyum install postgresql95-server\n<\/code><\/pre>\n<p>\u521d\u59cb\u5316\u6570\u636e\u5e93<\/p>\n<pre><code class=\"language-shell line-numbers\">service postgresql-9.5 initdb\n<\/code><\/pre>\n<p>\u542f\u52a8\u670d\u52a1<\/p>\n<pre><code class=\"language-shell line-numbers\">service postgresql-9.5 start\n<\/code><\/pre>\n<h3>\u8fdc\u7a0b\u8fde\u63a5<\/h3>\n<p>\u4fee\u6539<\/p>\n<p>vi \/var\/lib\/pgsql\/9.5\/data\/pg_hba.conf<\/p>\n<pre><code class=\"language-shell line-numbers\"># TYPE  DATABASE        USER            ADDRESS                 METHOD\n\n# \"local\" is for Unix domain socket connections only\nlocal   all             all                                     peer\n\n\n# IPv4 local connections:\nhost    all             all             127.0.0.1\/32            trust\n# IPv6 local connections:\nhost    all             all             ::1\/128                 ident\nhost    all             all             0.0.0.0\/0               trust\n# Allow replication connections from localhost, by a user with the\n# replication privilege.\n#local   replication     postgres                                peer\n#host    replication     postgres        127.0.0.1\/32            ident\n#host    replication     postgres        ::1\/128                 ident\n<\/code><\/pre>\n<p>vi \/var\/lib\/pgsql\/9.5\/data\/postgresql.conf<\/p>\n<pre><code class=\"language-shell line-numbers\">listen_addresses = '*'          # what IP address(es) to listen on;\n                                        # comma-separated list of addresses;\n                                        # defaults to 'localhost'; use '*' for all\n                                        # (change requires restart)\nport = 5432                             # (change requires restart)\n<\/code><\/pre>\n<h3><strong>\u521b\u5efa\u6570\u636e\u5e93<\/strong><\/h3>\n<pre><code class=\"language-shell line-numbers\">su - postgres\/\/\u8fdb\u5165\u6570\u636e\u5e93\n-bash-4.2$ psql\nCREATE USER kong WITH PASSWORD 'kong';\ncreate database kong owner kong;\ngrant all on database kong to kong;\n<\/code><\/pre>\n<h3>1.3\u4e0b\u8f7d\u5730\u5740<\/h3>\n<pre><code class=\"language-shell line-numbers\">https:\/\/kong.bintray.com\/kong-community-edition-rpm\/centos\/6\/\n<\/code><\/pre>\n<h3>\u5b89\u88c5<\/h3>\n<pre><code class=\"language-shell line-numbers\">rpm -ivh kong-community-edition-0.13.1.el6.noarch.rpm\n<\/code><\/pre>\n<h3>\u62f7\u8d1d\u914d\u7f6e\u6587\u4ef6<\/h3>\n<pre><code class=\"language-shell line-numbers\">\/etc\/kong\/kong.conf.default\n\/etc\/kong\/kong.conf\n<\/code><\/pre>\n<h3>\u521d\u59cb\u5316\u6570\u636e\u5e93<\/h3>\n<pre><code class=\"language-shell line-numbers\">1.4 kong migrations bootstrap\n1.3 kong migrations up\n<\/code><\/pre>\n<h3>\u542f\u52a8\u670d\u52a1<\/h3>\n<pre><code class=\"language-shell line-numbers\">kong start\n<\/code><\/pre>\n<h3>\u5b89\u88c5dashboard<\/h3>\n<p>https:\/\/github.com\/PGBI\/kong-dashboard<\/p>\n<p>\u6700\u65b0\u7684Kong\u662f0.14.x\uff0c\u800cKong-Dashboard\u6682\u65f6\u652f\u6301\u6700\u9ad8\u7248\u672c0.13.x<\/p>\n<p>\u5b89\u88c5npm<\/p>\n<pre><code class=\"language-shell line-numbers\">curl --silent --location https:\/\/rpm.nodesource.com\/setup_7.x | bash -\nsudo yum install -y nodejs\n<\/code><\/pre>\n<p>\u5b89\u88c5dashboard<\/p>\n<pre><code class=\"language-shell line-numbers\">npm install -g kong-dashboard\n<\/code><\/pre>\n<p>\u542f\u52a8<\/p>\n<pre><code class=\"language-shell line-numbers\">kong-dashboard start --kong-url http:\/\/localhost:8001\n<\/code><\/pre>\n<p>RPM\u5e38\u7528\u547d\u4ee4<\/p>\n<p><strong>1\u3001\u5b89\u88c5<\/strong><\/p>\n<p>rpm -i \u9700\u8981\u5b89\u88c5\u7684\u5305\u6587\u4ef6\u540d<\/p>\n<p>\u4e3e\u4f8b\u5982\u4e0b\uff1a<\/p>\n<p>rpm -i example.rpm \u5b89\u88c5 example.rpm \u5305\uff1b<\/p>\n<p>rpm -iv example.rpm \u5b89\u88c5 example.rpm \u5305\u5e76\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u663e\u793a\u6b63\u5728\u5b89\u88c5\u7684\u6587\u4ef6\u4fe1\u606f\uff1b<\/p>\n<p>rpm -ivh example.rpm \u5b89\u88c5 example.rpm \u5305\u5e76\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u663e\u793a\u6b63\u5728\u5b89\u88c5\u7684\u6587\u4ef6\u4fe1\u606f\u53ca\u5b89\u88c5\u8fdb\u5ea6\uff1b<\/p>\n<p><strong>2\u3001\u67e5\u770b\u5b89\u88c5\u5b8c\u6210\u7684\u8f6f\u4ef6<\/strong><\/p>\n<p>[root@jacky zookeeper]# rpm -qa | grep jdk java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.i686 java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686<\/p>\n<p><strong>3\u3001\u5378\u8f7d\u8f6f\u4ef6<\/strong><\/p>\n<p>rpm -e &#8211;nodeps \u8981\u5378\u8f7d\u7684\u8f6f\u4ef6\u5305<\/p>\n<p>root@jacky zookeeper]# rpm -e &#8211;nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.i686<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6d41\u91cf\u7f51\u5173\u548c\u4e1a\u52a1\u7f51\u5173 \u6d41\u91cf\u7f51\u5173 \u5168\u5c40\u6027\u6d41\u63a7 \u65e5\u5fd7\u7edf\u8ba1 \u9632\u6b62 SQL \u6ce8\u5165 \u9632\u6b62 Web \u653b\u51fb \u5c4f\u853d\u5de5\u5177\u626b\u63cf \u9ed1\u767d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[15],"tags":[390],"class_list":["post-3610","post","type-post","status-publish","format-standard","hentry","category-15","tag-390"],"_links":{"self":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts\/3610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3610"}],"version-history":[{"count":1,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts\/3610\/revisions"}],"predecessor-version":[{"id":3611,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts\/3610\/revisions\/3611"}],"wp:attachment":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}