{"id":57166,"date":"2025-08-15T08:20:02","date_gmt":"2025-08-15T00:20:02","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/57166.html"},"modified":"2025-08-15T08:20:02","modified_gmt":"2025-08-15T00:20:02","slug":"%e4%bc%81%e4%b8%9a%e7%ba%a7web%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8tomcat-%e7%9b%b8%e5%85%b3%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/57166.html","title":{"rendered":"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT---\u76f8\u5173\u90e8\u7f72"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"-toc\" style=\"margin-left:0px\">\n<p id=\"1.tomcat%E7%9A%84%E5%8A%9F%E8%83%BD%E4%BB%8B%E7%BB%8D-toc\" style=\"margin-left:0px\">1.tomcat\u7684\u529f\u80fd\u4ecb\u7ecd<\/p>\n<p id=\"3.1%20%E5%AE%89%E8%A3%85Tomcat%EF%BC%88%E4%B8%A4%E5%8F%B0%E4%B8%BB%E6%9C%BA%EF%BC%89-toc\" style=\"margin-left:40px\">3.1 \u5b89\u88c5Tomcat&#xff08;\u4e24\u53f0\u4e3b\u673a&#xff09;<\/p>\n<p id=\"3.2%20tomcat%E7%9A%84%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84%E5%92%8C%E7%BB%84%E6%88%90-toc\" style=\"margin-left:40px\">3.2 tomcat\u7684\u6587\u4ef6\u7ed3\u6784\u548c\u7ec4\u6210<\/p>\n<p id=\"3.3%20%E7%94%9F%E6%88%90tomcat%E7%9A%84%E5%90%AF%E5%8A%A8%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:40px\">3.3 \u751f\u6210tomcat\u7684\u542f\u52a8\u6587\u4ef6<\/p>\n<p id=\"2.%E7%BB%93%E5%90%88%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E5%AE%9E%E7%8E%B0tomcat%E9%83%A8%E7%BD%B2-toc\" style=\"margin-left:0px\">2.\u7ed3\u5408\u53cd\u5411\u4ee3\u7406\u5b9e\u73b0tomcat\u90e8\u7f72<\/p>\n<p id=\"2.1%20%E5%B8%B8%E8%A7%81%E9%83%A8%E7%BD%B2%E6%96%B9%E5%BC%8F%E4%BB%8B%E7%BB%8D-toc\" style=\"margin-left:40px\">2.1 \u5e38\u89c1\u90e8\u7f72\u65b9\u5f0f\u4ecb\u7ecd<\/p>\n<p id=\"2.2%20%E5%88%A9%E7%94%A8%20nginx%20%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E5%AE%9E%E7%8E%B0-toc\" style=\"margin-left:40px\">2.2 \u5229\u7528 nginx \u53cd\u5411\u4ee3\u7406\u5b9e\u73b0<\/p>\n<p id=\"3.Memcached-toc\" style=\"margin-left:0px\">3.Memcached<\/p>\n<p id=\"3.1%C2%A0memcached%E7%9A%84%E5%AE%89%E8%A3%85%E4%B8%8E%E5%90%AF%E5%8A%A8-toc\" style=\"margin-left:40px\">3.1\u00a0memcached\u7684\u5b89\u88c5\u4e0e\u542f\u52a8<\/p>\n<p id=\"3.2%20memcached%E6%93%8D%E4%BD%9C%E5%91%BD%E4%BB%A4-toc\" style=\"margin-left:40px\">3.2 memcached\u64cd\u4f5c\u547d\u4ee4<\/p>\n<p id=\"4.session%20%E5%85%B1%E4%BA%AB%E6%9C%8D%E5%8A%A1%E5%99%A8-toc\" style=\"margin-left:0px\">4.session \u5171\u4eab\u670d\u52a1\u5668<\/p>\n<p id=\"4.1%20msm%E4%BB%8B%E7%BB%8D-toc\" style=\"margin-left:40px\">4.1 msm\u4ecb\u7ecd<\/p>\n<p id=\"4.2%20%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE-toc\" style=\"margin-left:40px\">4.2 \u5b89\u88c5\u4e0e\u914d\u7f6e<\/p>\n<hr id=\"hr-toc\" \/>\n<h2 id=\"1.tomcat%E7%9A%84%E5%8A%9F%E8%83%BD%E4%BB%8B%E7%BB%8D\"><span style=\"color:#333333\">1.tomcat<\/span><span style=\"color:#333333\">\u7684\u529f\u80fd\u4ecb\u7ecd<\/span><\/h2>\n<p> <img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"486\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001956-689e7d2c8e1c7.png\" width=\"939\" \/><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Tomcat \u670d\u52a1\u5668\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u653e\u6e90\u4ee3\u7801\u7684<\/span><span style=\"color:#333333\">Web <\/span><span style=\"color:#333333\">\u5e94\u7528\u670d\u52a1\u5668&#xff0c;\u5c5e\u4e8e\u8f7b\u91cf\u7ea7\u5e94\u7528\u670d\u52a1\u5668&#xff0c;\u5728\u4e2d\u5c0f\u578b\u7cfb\u7edf\u548c\u5e76\u53d1\u8bbf\u95ee\u7528\u6237\u4e0d\u662f\u5f88\u591a\u7684\u573a\u5408\u4e0b\u88ab\u666e\u904d\u4f7f\u7528&#xff0c;Tomcat <\/span><span style=\"color:#333333\">\u5177\u6709\u5904\u7406<\/span><span style=\"color:#333333\">HTML<\/span><span style=\"color:#333333\">\u9875\u9762\u7684\u529f\u80fd&#xff0c;\u5b83\u8fd8\u662f\u4e00\u4e2a<\/span><span style=\"color:#333333\">Servlet<\/span><span style=\"color:#333333\">\u548cJSP\u5bb9\u5668<\/span><\/p>\n<p><span style=\"color:#333333\">\u8d77\u59cb\u4e8e<\/span><span style=\"color:#333333\">SUN <\/span><span style=\"color:#333333\">\u516c\u53f8\u7684\u4e00\u4e2a<\/span><span style=\"color:#333333\">Servlet<\/span><span style=\"color:#333333\">\u7684\u53c2\u8003\u5b9e\u73b0\u9879\u76ee<\/span><span style=\"color:#333333\"> Java Web Server<\/span><span style=\"color:#333333\">&#xff0c;\u5f00\u53d1\u8005\u662f<\/span><span style=\"color:#333333\"> James Duncan Davidson<\/span><span style=\"color:#333333\">&#xff0c;\u57281999<\/span><span style=\"color:#333333\">\u5e74&#xff0c;\u5c06\u9879\u76ee\u8d21\u732e\u7ed9\u4e86<\/span><span style=\"color:#333333\">apache<\/span><span style=\"color:#333333\">\u8f6f\u4ef6\u57fa\u91d1\u4f1a&#xff08;<\/span><span style=\"color:#333333\">ASF<\/span><span style=\"color:#333333\">&#xff09;&#xff0c;\u548c<\/span><span style=\"color:#333333\">ASF<\/span><span style=\"color:#333333\">\u73b0\u6709\u7684\u9879\u76ee<\/span><span style=\"color:#333333\"> JServ <\/span><span style=\"color:#333333\">\u5408\u5e76&#xff0c;\u5e76\u5f00\u6e90\u6210\u4e3a\u9876\u7ea7\u9879\u76ee <\/span><\/p>\n<p><span style=\"color:#333333\">Tomcat <\/span><span style=\"color:#333333\">\u4ec5\u4ec5\u5b9e\u73b0\u4e86<\/span><span style=\"color:#333333\">Java EE<\/span><span style=\"color:#333333\">\u89c4\u8303\u4e2d\u4e0e<\/span><span style=\"color:#333333\">Servlet<\/span><span style=\"color:#333333\">\u3001<\/span><span style=\"color:#333333\">JSP<\/span><span style=\"color:#333333\">\u76f8\u5173\u7684\u7c7b\u5e93&#xff0c;\u662f<\/span><span style=\"color:#333333\">JavaEE<\/span><span style=\"color:#333333\">\u4e0d\u5b8c\u6574\u5b9e\u73b0\u3002 <\/span><\/p>\n<p><span style=\"color:#333333\">1999<\/span><span style=\"color:#333333\">\u5e74\u53d1\u5e03\u521d\u59cb\u7248\u672c\u662f<\/span><span style=\"color:#333333\">Tomcat 3.0<\/span><span style=\"color:#333333\">&#xff0c;\u5b9e\u73b0\u4e86<\/span><span style=\"color:#333333\">Servlet 2.2 <\/span><span style=\"color:#333333\">\u548c<\/span><span style=\"color:#333333\"> JSP 1.1<\/span><span style=\"color:#333333\">\u89c4\u8303\u3002 <\/span><\/p>\n<p><span style=\"color:#333333\">Tomcat 4.x<\/span><span style=\"color:#333333\">\u53d1\u5e03\u65f6&#xff0c;\u5185\u5efa\u4e86<\/span><span style=\"color:#333333\">Catalina<\/span><span style=\"color:#333333\">&#xff08;<\/span><span style=\"color:#333333\">Servlet<\/span><span style=\"color:#333333\">\u5bb9\u5668&#xff09;\u548c<\/span><span style=\"color:#333333\"> Jasper<\/span><span style=\"color:#333333\">&#xff08;<\/span><span style=\"color:#333333\">JSP engine<\/span><span style=\"color:#333333\">&#xff09;\u7b49 <\/span><\/p>\n<p><span style=\"color:#333333\">\u5f53\u524d<\/span><span style=\"color:#333333\"> Tomcat <\/span><span style=\"color:#333333\">\u7684\u6b63\u5f0f\u7248\u672c\u5df2\u7ecf\u66f4\u65b0\u5230<\/span><span style=\"color:#333333\"> 9.0.x <\/span><span style=\"color:#333333\">\u7248\u672c&#xff0c;\u4f46\u5f53\u524d\u4f01\u4e1a\u4e2d\u4e3b\u6d41\u7248\u672c\u4e3a<\/span><span style=\"color:#333333\"> 8.x <\/span><span style=\"color:#333333\">\u548c<\/span><span style=\"color:#333333\"> 7.x <\/span><\/p>\n<p><span style=\"color:#333333\">\u5b98\u7f51<\/span><span style=\"color:#333333\">: <\/span><\/p>\n<p><span style=\"color:#4183c4\">http:\/\/tomcat.apache.org\/ <\/span><\/p>\n<p><span style=\"color:#333333\">\u5b98\u7f51\u6587\u6863<\/span><span style=\"color:#333333\">: <\/span><\/p>\n<p><span style=\"color:#4183c4\">https:\/\/tomcat.apache.org\/tomcat-8.5-doc\/index.html <\/span><\/p>\n<p><span style=\"color:#333333\">\u5e2e\u52a9\u6587\u6863<\/span><span style=\"color:#333333\">: <\/span><\/p>\n<p><span style=\"color:#4183c4\">https:\/\/cwiki.apache.org\/confluence\/display\/tomcat\/ <\/span><\/p>\n<p><span style=\"color:#4183c4\">https:\/\/cwiki.apache.org\/confluence\/display\/tomcat\/FAQ<\/span><\/p>\n<h3 id=\"3.1%20%E5%AE%89%E8%A3%85Tomcat%EF%BC%88%E4%B8%A4%E5%8F%B0%E4%B8%BB%E6%9C%BA%EF%BC%89\">3.1 \u5b89\u88c5<span style=\"color:#333333\">Tomcat&#xff08;\u4e24\u53f0\u4e3b\u673a&#xff09;<\/span><\/h3>\n<p>&#xff08;1&#xff09;\u5b89\u88c5java\u73af\u5883<\/p>\n<p> # \u5b89\u88c5java\u73af\u5883<br \/>\n[root&#064;tomcata ~]# dnf install java-1.8.0-openjdk.x86_64 -y<\/p>\n<p># \u67e5\u770bjava\u7248\u672c<br \/>\n[root&#064;tomcatb ~]# java -version<br \/>\nopenjdk version &#034;1.8.0_345&#034;<br \/>\nOpenJDK Runtime Environment (build 1.8.0_345-b01)<br \/>\nOpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)<\/p>\n<p># \u67e5\u770bjava\u7684\u73af\u5883\u76ee\u5f55<br \/>\n[root&#064;tomcatb ~]# ll \/usr\/bin\/java<br \/>\nlrwxrwxrwx 1 root root 22 Aug 13 01:44 \/usr\/bin\/java -&gt; \/etc\/alternatives\/java <\/p>\n<p>  <span style=\"color:#333333\">&#xff08;2&#xff09;\u5b89\u88c5\u5e76\u542f\u52a8<\/span><span style=\"color:#333333\">tomcat<\/span><\/p>\n<p>  # \u89e3\u538b\u5e76\u751f\u6210tomcat\u7684\u7a0b\u5e8f\u76ee\u5f55<br \/>\n[root&#064;tomcata ~]# cd \/mnt\/<br \/>\n[root&#064;tomcata mnt]# tar zxf apache-tomcat-9.0.107.tar.gz -C \/usr\/local\/<br \/>\n[root&#064;tomcata mnt]# cd \/usr\/local\/<br \/>\n[root&#064;tomcata local]# ls<br \/>\napache-tomcat-9.0.107  bin  etc  games  include  lib  lib64  libexec  sbin  share  src<br \/>\n[root&#064;tomcata local]# mv apache-tomcat-9.0.107\/ tomcat<\/p>\n<p># \u542f\u52a8tomcat<br \/>\n[root&#064;tomcata local]# cd tomcat<br \/>\n[root&#064;tomcata tomcat]# cd bin\/<br \/>\n[root&#064;tomcata bin]# .\/startup.sh<br \/>\nUsing CATALINA_BASE:   \/usr\/local\/tomcat<br \/>\nUsing CATALINA_HOME:   \/usr\/local\/tomcat<br \/>\nUsing CATALINA_TMPDIR: \/usr\/local\/tomcat\/temp<br \/>\nUsing JRE_HOME:        \/usr<br \/>\nUsing CLASSPATH:       \/usr\/local\/tomcat\/bin\/bootstrap.jar:\/usr\/local\/tomcat\/bin\/tomcat-juli.jar<br \/>\nUsing CATALINA_OPTS:<br \/>\nTomcat started. <\/p>\n<p><span style=\"color:#333333\">&#xff08;3&#xff09;\u67e5\u770b\u7aef\u53e3<\/span><\/p>\n<p>  [root&#064;tomcata bin]#  netstat -antlupe | grep java<br \/>\ntcp6       0      0 :::8080                 :::*                    LISTEN      0          55005      28559\/java<br \/>\ntcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      0          55633      28559\/java<\/p>\n<p>\u8bbf\u95ee\u6d4b\u8bd5<span style=\"color:#fe2c24\">&#xff08;\u8bb0\u5f97\u5173\u706b\u5899&#xff09;<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"897\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001956-689e7d2cd9627.png\" width=\"2118\" \/><\/p>\n<\/p>\n<h3 id=\"3.2%20tomcat%E7%9A%84%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84%E5%92%8C%E7%BB%84%E6%88%90\"><span style=\"color:#333333\">3.2 tomcat<\/span><span style=\"color:#333333\">\u7684\u6587\u4ef6\u7ed3\u6784\u548c\u7ec4\u6210<\/span><\/h3>\n<p>   <span style=\"color:#333333\">\u76ee\u5f55\u7ed3\u6784<\/span><\/p>\n<p>     <span style=\"color:#333333\">\u76ee\u5f55 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8bf4\u660e <\/span><\/p>\n<p>     <span style=\"color:#0000cc\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- <\/span><\/p>\n<p>     <span style=\"color:#333333\">bin\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u670d\u52a1\u542f\u52a8\u3001\u505c\u6b62\u7b49\u76f8\u5173\u7a0b\u5e8f\u548c\u6587\u4ef6 <\/span><\/p>\n<p>     <span style=\"color:#333333\">conf\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u914d\u7f6e\u6587\u4ef6 <\/span><\/p>\n<p>     <span style=\"color:#333333\">lib\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u5e93\u76ee\u5f55 <\/span><\/p>\n<p>     <span style=\"color:#333333\">logs\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u65e5\u5fd7\u76ee\u5f55 <\/span><\/p>\n<p>     <span style=\"color:#333333\">webapps\u00a0\u00a0<\/span><br \/>\n     <span style=\"color:#333333\">\u5e94\u7528\u7a0b\u5e8f&#xff0c;\u5e94\u7528\u90e8\u7f72\u76ee\u5f55&#xff0c;\u76f8\u5f53\u4e8e<\/span><br \/>\n     <span style=\"color:#333333\">nginx<\/span><br \/>\n     <span style=\"color:#333333\">\u7684\u9ed8\u8ba4\u53d1\u5e03\u76ee\u5f55 <\/span><\/p>\n<p>     <span style=\"color:#333333\">work jsp\u00a0 \u00a0<\/span><br \/>\n     <span style=\"color:#333333\">\u7f16\u8bd1\u540e\u7684\u7ed3\u679c\u6587\u4ef6&#xff0c;\u5efa\u8bae\u63d0\u524d\u9884\u70ed\u8bbf\u95ee<\/span><\/p>\n<p><span style=\"color:#333333\">\u67e5\u770b<\/span><span style=\"color:#333333\">tomcat<\/span><span style=\"color:#333333\">\u76f8\u5173\u76ee\u5f55\u548c\u6587\u4ef6<\/span><\/p>\n<p> <img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"87\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001958-689e7d2e635b8.png\" width=\"1563\" \/><\/p>\n<h3 id=\"3.3%20%E7%94%9F%E6%88%90tomcat%E7%9A%84%E5%90%AF%E5%8A%A8%E6%96%87%E4%BB%B6\"><span style=\"color:#333333\">3.3 <\/span><span style=\"color:#333333\">\u751f\u6210<\/span><span style=\"color:#333333\">tomcat<\/span><span style=\"color:#333333\">\u7684\u542f\u52a8\u6587\u4ef6<\/span><\/h3>\n<p><span style=\"color:#333333\">&#xff08;1&#xff09;<\/span><span style=\"color:#333333\">\u751f\u6210<\/span><span style=\"color:#333333\">tomcat<\/span><span style=\"color:#333333\">\u7684\u4e3b\u914d\u7f6e\u6587\u4ef6<\/span><\/p>\n<p> [root&#064;tomcatb bin]# vim \/usr\/local\/tomcat\/conf\/tomcat.conf<\/p>\n<p>JAVA_HOME&#061;\/etc\/alternatives\/jre <\/p>\n<p><span style=\"color:#333333\">&#xff08;2&#xff09;<\/span><span style=\"color:#333333\">\u751f\u6210\u542f\u52a8\u6587\u4ef6<\/span><\/p>\n<p> [root&#064;tomcatb bin]# vim \/lib\/systemd\/system\/tomcat.service<\/p>\n<p>[Unit]<br \/>\nDescription&#061;Tomcat<br \/>\n#After&#061;syslog.target network.target remote-fs.target nss-lookup.target<br \/>\nAfter&#061;syslog.target network.target<\/p>\n<p>[Service]<br \/>\nType&#061;forking<br \/>\nEnvironmentFile&#061;\/usr\/local\/tomcat\/conf\/tomcat.conf<br \/>\nExecStart&#061;\/usr\/local\/tomcat\/bin\/startup.sh<br \/>\nExecStop&#061;\/usr\/local\/tomcat\/bin\/shutdown.sh<br \/>\nPrivateTmp&#061;true<br \/>\nUser&#061;tomcat<br \/>\nGroup&#061;tomcat<\/p>\n<p>[Install]<br \/>\nWantedBy&#061;multi-user.target <\/p>\n<p>&#xff08;3&#xff09;\u751f\u6210tomcat\u7528\u6237\u5e76\u8bbe\u5b9a\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\u6743\u9650<\/p>\n<p> [root&#064;tomcatb bin]# useradd -s \/sbin\/nologin -M tomcat<br \/>\n[root&#064;tomcatb bin]# chown tomcat.tomcat \/usr\/local\/tomcat\/ -R <\/p>\n<p><span style=\"color:#333333\">&#xff08;4&#xff09;\u7528\u542f\u52a8\u811a\u672c\u5f00\u542f\u670d\u52a1<\/span><\/p>\n<p> [root&#064;tomcatb bin]# systemctl enable &#8211;now tomcat.service <\/p>\n<h2 id=\"2.%E7%BB%93%E5%90%88%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E5%AE%9E%E7%8E%B0tomcat%E9%83%A8%E7%BD%B2\"><span style=\"color:#333333\">2.\u7ed3\u5408\u53cd\u5411\u4ee3\u7406\u5b9e\u73b0<\/span><span style=\"color:#333333\">tomcat<\/span><span style=\"color:#333333\">\u90e8\u7f72<\/span><\/h2>\n<h3 id=\"2.1%20%E5%B8%B8%E8%A7%81%E9%83%A8%E7%BD%B2%E6%96%B9%E5%BC%8F%E4%BB%8B%E7%BB%8D\"><span style=\"color:#333333\">2.1 <\/span><span style=\"color:#333333\">\u5e38\u89c1\u90e8\u7f72\u65b9\u5f0f\u4ecb\u7ecd<\/span><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"585\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001958-689e7d2e95e0e.png\" width=\"981\" \/><\/p>\n<ul>\n<li><span style=\"color:#333333\">standalone<\/span><span style=\"color:#333333\">\u6a21\u5f0f&#xff0c;<\/span><span style=\"color:#333333\">Tomcat<\/span><span style=\"color:#333333\">\u5355\u72ec\u8fd0\u884c&#xff0c;\u76f4\u63a5\u63a5\u53d7\u7528\u6237\u7684\u8bf7\u6c42&#xff0c;\u4e0d\u63a8\u8350\u3002 <\/span><\/li>\n<li><span style=\"color:#333333\">\u53cd\u5411\u4ee3\u7406&#xff0c;\u5355\u673a\u8fd0\u884c&#xff0c;\u63d0\u4f9b\u4e86\u4e00\u4e2a<\/span><span style=\"color:#333333\">Nginx<\/span><span style=\"color:#333333\">\u4f5c\u4e3a\u53cd\u5411\u4ee3\u7406&#xff0c;\u53ef\u4ee5\u505a\u5230\u9759\u6001\u7531<\/span><span style=\"color:#333333\">nginx<\/span><span style=\"color:#333333\">\u63d0\u4f9b\u54cd\u5e94&#xff0c;\u52a8\u6001<\/span><span style=\"color:#333333\">jsp<\/span><span style=\"color:#333333\">\u4ee3\u7406\u7ed9Tomcat<\/span>\n<ul>\n<li><span style=\"color:#333333\">LNMT<\/span><span style=\"color:#333333\">&#xff1a;<\/span><span style=\"color:#333333\">Linux &#043; Nginx &#043; MySQL &#043; Tomcat<\/span><\/li>\n<li><span style=\"color:#333333\">LAMT<\/span><span style=\"color:#333333\">&#xff1a;<\/span><span style=\"color:#333333\">Linux &#043; Apache<\/span><span style=\"color:#333333\">&#xff08;<\/span><span style=\"color:#333333\">Httpd<\/span><span style=\"color:#333333\">&#xff09;<\/span><span style=\"color:#333333\">&#043; MySQL &#043; Tomcat <\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color:#333333\">\u524d\u7f6e\u4e00\u53f0<\/span><span style=\"color:#333333\">Nginx<\/span><span style=\"color:#333333\">&#xff0c;\u7ed9\u591a\u53f0<\/span><span style=\"color:#333333\">Tomcat<\/span><span style=\"color:#333333\">\u5b9e\u4f8b\u505a\u53cd\u5411\u4ee3\u7406\u548c\u8d1f\u8f7d\u5747\u8861\u8c03\u5ea6&#xff0c;<\/span><span style=\"color:#333333\">Tomcat<\/span><span style=\"color:#333333\">\u4e0a\u90e8\u7f72\u7684\u7eaf\u52a8\u6001\u9875\u9762\u66f4<\/span><span style=\"color:#333333\">\u9002\u5408<\/span>\n<ul>\n<li><span style=\"color:#333333\">LNMT<\/span><span style=\"color:#333333\">&#xff1a;<\/span><span style=\"color:#333333\">Linux &#043; Nginx &#043; MySQL &#043; Tomcat <\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color:#333333\">\u591a\u7ea7\u4ee3\u7406<\/span>\n<ul>\n<li><span style=\"color:#333333\">\u200b\u200b\u200b\u200b\u200b\u200b\u200b<\/span><span style=\"color:#333333\">LNNMT<\/span><span style=\"color:#333333\">&#xff1a;<\/span><span style=\"color:#333333\">Linux &#043; Nginx &#043; Nginx &#043; MySQL &#043; Tomcat<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3 id=\"2.2%20%E5%88%A9%E7%94%A8%20nginx%20%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E5%AE%9E%E7%8E%B0\"><span style=\"color:#333333\">2.2 <\/span><span style=\"color:#333333\">\u5229\u7528<\/span><span style=\"color:#333333\"> nginx <\/span><span style=\"color:#333333\">\u53cd\u5411\u4ee3\u7406\u5b9e\u73b0<\/span><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"354\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001958-689e7d2ec8adf.png\" width=\"980\" \/><\/p>\n<p><span style=\"color:#333333\">\u5229\u7528<\/span><span style=\"color:#333333\">nginx<\/span><span style=\"color:#333333\">\u53cd\u5411\u4ee3\u7406\u529f\u80fd&#xff0c;\u5b9e\u73b0\u56fe\u4e2d\u7684\u4ee3\u7406\u529f\u80fd&#xff0c;\u5c06\u7528\u6237\u8bf7\u6c42\u5168\u90e8\u8f6c\u53d1\u81f3\u6307\u5b9a\u7684\u540c\u4e00\u4e2a<\/span><span style=\"color:#333333\">tomcat<\/span><span style=\"color:#333333\">\u4e3b\u673a <\/span><\/p>\n<p><span style=\"color:#333333\">\u5229\u7528<\/span><span style=\"color:#333333\">nginx<\/span><span style=\"color:#333333\">\u6307\u4ee4<\/span><span style=\"color:#333333\">proxy_pass <\/span><span style=\"color:#333333\">\u53ef\u4ee5\u5411\u540e\u7aef\u670d\u52a1\u5668\u8f6c\u53d1\u8bf7\u6c42\u62a5\u6587<\/span><span style=\"color:#333333\">,<\/span><span style=\"color:#333333\">\u5e76\u4e14\u5728\u8f6c\u53d1\u65f6\u4f1a\u4fdd\u7559\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\u62a5\u6587\u4e2d\u7684host\u9996\u90e8<\/span><\/p>\n<p>&#xff08;1&#xff09;\u5728Nginx\u670d\u52a1\u5668\u5f00\u542fNginx\u670d\u52a1<\/p>\n<p>\u91c7\u7528\u5b50\u914d\u7f6e\u6587\u4ef6\u7684\u65b9\u5f0f<\/p>\n<p> [root&#064;tom-nginx ~]# dnf install nginx -y<\/p>\n<p>[root&#064;tom-nginx ~]# vim \/etc\/nginx\/nginx.conf<\/p>\n<p>include \/etc\/nginx\/conf.d\/*.conf;<\/p>\n<p>[root&#064;tom-nginx ~]# vim \/etc\/nginx\/conf.d\/vhosts.conf<\/p>\n<p>upstream tomcat {<br \/>\n        hash $cookie_JSESSIONID;<br \/>\n        server 172.25.254.10:8080;<br \/>\n        server 172.25.254.20:8080;<br \/>\n}<br \/>\nserver {<br \/>\n        listen 80;<br \/>\n        server_name www.guanai.org;<br \/>\n        location ~ \\\\.jsp$ {<br \/>\n                proxy_pass http:\/\/tomcat;<br \/>\n        }<br \/>\n}<\/p>\n<p># \u91cd\u542f\u670d\u52a1<br \/>\n[root&#064;tom-nginx ~]# systemctl restart nginx.service <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"768\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001959-689e7d2f00c8a.png\" width=\"1052\" \/><\/p>\n<p>\u505a\u597d\u57df\u540d\u89e3\u6790<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"129\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001959-689e7d2f68970.png\" width=\"953\" \/><\/p>\n<p>&#xff08;2&#xff09;Tomcat\u670d\u52a1\u5668\u914d\u7f6e<\/p>\n<p>\u4e0a\u4f20\u6d4b\u8bd5\u6587\u4ef6&#xff08;\u4e24\u53f0\u670d\u52a1\u5668\u5747\u8981\u914d\u7f6e&#xff09;<\/p>\n<p> [root&#064;tomcatb bin]# cd \/usr\/local\/tomcat\/webapps\/ROOT\/<\/p>\n<p>[root&#064;tomcatb ROOT]# systemctl restart tomcat.service <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"87\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001959-689e7d2f89d37.png\" width=\"1914\" \/><\/p>\n<p>\u8bbf\u95ee\u6d4b\u8bd5&#xff08;windows\u4e3b\u673a\u505a\u597d\u672c\u5730\u57df\u540d\u89e3\u6790&#xff09;&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"407\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001959-689e7d2fb3065.png\" width=\"1017\" \/><\/p>\n<h2 id=\"3.Memcached\"> <span style=\"color:#333333\">3.Memcached<\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"186\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001959-689e7d2fdb696.png\" width=\"990\" \/><\/p>\n<p><span style=\"color:#333333\">Memcached <\/span><span style=\"color:#333333\">\u53ea\u652f\u6301\u80fd\u5e8f\u5217\u5316\u7684\u6570\u636e\u7c7b\u578b&#xff0c;\u4e0d\u652f\u6301\u6301\u4e45\u5316&#xff0c;\u57fa\u4e8e<\/span><span style=\"color:#333333\">Key-Value<\/span><span style=\"color:#333333\">\u7684\u5185\u5b58\u7f13\u5b58\u7cfb\u7edf<\/span><span style=\"color:#333333\">memcached\u867d\u7136\u6ca1\u6709\u50cfredis<\/span><span style=\"color:#333333\">\u6240\u5177\u5907\u7684\u6570\u636e\u6301\u4e45\u5316\u529f\u80fd&#xff0c;\u6bd4\u5982<\/span><span style=\"color:#333333\">RDB<\/span><span style=\"color:#333333\">\u548c<\/span><span style=\"color:#333333\">AOF<\/span><span style=\"color:#333333\">\u90fd\u6ca1\u6709&#xff0c;\u4f46\u662f\u53ef\u4ee5\u901a\u8fc7\u505a\u96c6\u7fa4\u540c\u6b65\u7684\u65b9\u5f0f&#xff0c;\u8ba9\u5404memcached<\/span><span style=\"color:#333333\">\u670d\u52a1\u5668\u7684\u6570\u636e\u8fdb\u884c\u540c\u6b65&#xff0c;\u4ece\u800c\u5b9e\u73b0\u6570\u636e\u7684\u4e00\u81f4\u6027&#xff0c;\u5373\u4fdd\u8bc1\u5404<\/span><span style=\"color:#333333\">memcached<\/span><span style=\"color:#333333\">\u7684\u6570\u636e\u662f\u4e00\u6837\u7684&#xff0c;\u5373\u4f7f\u6709\u4efb\u4f55\u4e00\u53f0 memcached <\/span><span style=\"color:#333333\">\u53d1\u751f\u6545\u969c&#xff0c;\u53ea\u8981\u96c6\u7fa4\u4e2d\u6709\u4e00\u53f0<\/span><span style=\"color:#333333\"> memcached <\/span><span style=\"color:#333333\">\u53ef\u7528\u5c31\u4e0d\u4f1a\u51fa\u73b0\u6570\u636e\u4e22\u5931&#xff0c;\u5f53\u5176\u4ed6memcached <\/span><span style=\"color:#333333\">\u91cd\u65b0\u52a0\u5165\u5230\u96c6\u7fa4\u7684\u65f6\u5019<\/span><span style=\"color:#333333\">,<\/span><span style=\"color:#333333\">\u53ef\u4ee5\u81ea\u52a8\u4ece\u6709\u6570\u636e\u7684<\/span><span style=\"color:#333333\">memcached <\/span><span style=\"color:#333333\">\u5f53\u4e2d\u81ea\u52a8\u83b7\u53d6\u6570\u636e\u5e76\u63d0\u4f9b\u670d\u52a1\u3002 <\/span><\/p>\n<p><span style=\"color:#333333\">Memcached <\/span><span style=\"color:#333333\">\u501f\u52a9\u4e86\u64cd\u4f5c\u7cfb\u7edf\u7684<\/span><span style=\"color:#333333\"> libevent <\/span><span style=\"color:#333333\">\u5de5\u5177\u505a\u9ad8\u6548\u7684\u8bfb\u5199\u3002<\/span><span style=\"color:#333333\">libevent<\/span><span style=\"color:#333333\">\u662f\u4e2a\u7a0b\u5e8f\u5e93&#xff0c;\u5b83\u5c06<\/span><span style=\"color:#333333\">Linux<\/span><span style=\"color:#333333\">\u7684<\/span><span style=\"color:#333333\">epoll<\/span><span style=\"color:#333333\">\u3001BSD\u7c7b\u64cd\u4f5c\u7cfb\u7edf\u7684<\/span><span style=\"color:#333333\">kqueue<\/span><span style=\"color:#333333\">\u7b49\u4e8b\u4ef6\u5904\u7406\u529f\u80fd\u5c01\u88c5\u6210\u7edf\u4e00\u7684\u63a5\u53e3\u3002\u5373\u4f7f\u5bf9\u670d\u52a1\u5668\u7684\u8fde\u63a5\u6570\u589e\u52a0&#xff0c;\u4e5f\u80fd\u53d1\u6325\u9ad8\u6027\u80fd\u3002memcached<\/span><span style=\"color:#333333\">\u4f7f\u7528\u8fd9\u4e2a<\/span><span style=\"color:#333333\">libevent<\/span><span style=\"color:#333333\">\u5e93&#xff0c;\u56e0\u6b64\u80fd\u5728<\/span><span style=\"color:#333333\">Linux<\/span><span style=\"color:#333333\">\u3001<\/span><span style=\"color:#333333\">BSD<\/span><span style=\"color:#333333\">\u3001<\/span><span style=\"color:#333333\">Solaris<\/span><span style=\"color:#333333\">\u7b49\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u53d1\u6325\u5176\u9ad8\u6027\u80fd<\/span><\/p>\n<p><span style=\"color:#333333\">Memcached \u652f\u6301\u6700\u5927\u7684\u5185\u5b58\u5b58\u50a8\u5bf9\u8c61\u4e3a<\/span><span style=\"color:#333333\">1M<\/span><span style=\"color:#333333\">&#xff0c;\u8d85\u8fc7<\/span><span style=\"color:#333333\">1M<\/span><span style=\"color:#333333\">\u7684\u6570\u636e\u53ef\u4ee5\u4f7f\u7528\u5ba2\u6237\u7aef\u538b\u7f29\u6216\u62c6\u5206\u62a5\u5305\u653e\u5230\u591a\u4e2akey\u4e2d&#xff0c;\u6bd4\u8f83\u5927\u7684\u6570\u636e\u5728\u8fdb\u884c\u8bfb\u53d6\u7684\u65f6\u5019\u9700\u8981\u6d88\u8017\u7684\u65f6\u95f4\u6bd4\u8f83\u957f&#xff0c;<\/span><span style=\"color:#333333\">memcached <\/span><span style=\"color:#333333\">\u6700\u9002\u5408\u4fdd\u5b58\u7528\u6237\u7684session\u5b9e\u73b0<\/span><span style=\"color:#333333\">session<\/span><span style=\"color:#333333\">\u5171\u4eab <\/span><\/p>\n<p><span style=\"color:#333333\">Memcached<\/span><span style=\"color:#333333\">\u5b58\u50a8\u6570\u636e\u65f6<\/span><span style=\"color:#333333\">, Memcached<\/span><span style=\"color:#333333\">\u4f1a\u53bb\u7533\u8bf7<\/span><span style=\"color:#333333\">1MB<\/span><span style=\"color:#333333\">\u7684\u5185\u5b58<\/span><span style=\"color:#333333\">, <\/span><span style=\"color:#333333\">\u628a\u8be5\u5757\u5185\u5b58\u79f0\u4e3a\u4e00\u4e2a<\/span><span style=\"color:#333333\">slab, <\/span><span style=\"color:#333333\">\u4e5f\u79f0\u4e3a\u4e00\u4e2a<\/span><span style=\"color:#333333\">page <\/span><\/p>\n<p><span style=\"color:#333333\">Memcached <\/span><span style=\"color:#333333\">\u652f\u6301\u591a\u79cd\u5f00\u53d1\u8bed\u8a00&#xff0c;\u5305\u62ec&#xff1a;<\/span><span style=\"color:#333333\">JAVA,C,Python,PHP,C#,Ruby,Perl<\/span><span style=\"color:#333333\">\u7b49 <\/span><\/p>\n<p><span style=\"color:#333333\">Memcached <\/span><span style=\"color:#333333\">\u5b98\u7f51&#xff1a;<\/span><span style=\"color:#4183c4\">http:\/\/memcached.org\/<\/span><\/p>\n<h3 id=\"3.1%C2%A0memcached%E7%9A%84%E5%AE%89%E8%A3%85%E4%B8%8E%E5%90%AF%E5%8A%A8\"><span style=\"color:#333333\">3.1\u00a0memcached<\/span><span style=\"color:#333333\">\u7684\u5b89\u88c5\u4e0e\u542f\u52a8<\/span><\/h3>\n<p> [root&#064;tomcata ~]# dnf install memcached -y<br \/>\n[root&#064;tomcat ~]# vim \/etc\/sysconfig\/memcached<br \/>\nPORT&#061;&#034;11211&#034;<br \/>\nUSER&#061;&#034;memcached&#034;<br \/>\nMAXCONN&#061;&#034;1024&#034;<br \/>\nCACHESIZE&#061;&#034;64&#034;<br \/>\nOPTIONS&#061;&#034;-l 0.0.0.0,::1&#034;<\/p>\n<p>[root&#064;tomcata ~]# systemctl enable &#8211;now memcached<br \/>\n[root&#064;tomcata ~]# netstat -antlupe | grep memcache<br \/>\ntcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      981        62649      30140\/memcached<br \/>\ntcp6       0      0 ::1:11211               :::*                    LISTEN      981        62650      30140\/memcached<\/p>\n<h3 id=\"3.2%20memcached%E6%93%8D%E4%BD%9C%E5%91%BD%E4%BB%A4\">3.2 memcached\u64cd\u4f5c\u547d\u4ee4<\/h3>\n<p>\u4e94\u79cd\u57fa\u672c memcached \u547d\u4ee4\u6267\u884c\u6700\u7b80\u5355\u7684\u64cd\u4f5c\u3002\u8fd9\u4e9b\u547d\u4ee4\u548c\u64cd\u4f5c\u5305\u62ec&#xff1a;set\u3001add\u3001replace\u3001get\u3001delete<\/p>\n<p> #\u524d\u4e09\u4e2a\u547d\u4ee4\u662f\u7528\u4e8e\u64cd\u4f5c\u5b58\u50a8\u5728 memcached \u4e2d\u7684\u952e\u503c\u5bf9\u7684\u6807\u51c6\u4fee\u6539\u547d\u4ee4,\u90fd\u4f7f\u7528\u5982\u4e0b\u6240\u793a\u7684\u8bed\u6cd5&#xff1a;<br \/>\ncommand &lt;key&gt; &lt;flags&gt; &lt;expiration time&gt; &lt;bytes&gt;<br \/>\n&lt;value&gt;<\/p>\n<p>#\u53c2\u6570\u8bf4\u660e\u5982\u4e0b&#xff1a;<br \/>\ncommand set\/add\/replace<br \/>\nkey \u7528\u4e8e\u67e5\u627e\u7f13\u5b58\u503c<br \/>\nflags \u53ef\u4ee5\u5305\u62ec\u952e\u503c\u5bf9\u7684\u6574\u578b\u53c2\u6570&#xff0c;\u5ba2\u6237\u673a\u4f7f\u7528\u5b83\u5b58\u50a8\u5173\u4e8e\u952e\u503c\u5bf9\u7684\u989d\u5916\u4fe1\u606f<br \/>\nexpiration time \u5728\u7f13\u5b58\u4e2d\u4fdd\u5b58\u952e\u503c\u5bf9\u7684\u65f6\u95f4\u957f\u5ea6&#xff08;\u4ee5\u79d2\u4e3a\u5355\u4f4d&#xff0c;0 \u8868\u793a\u6c38\u8fdc&#xff09;<br \/>\nbytes \u5728\u7f13\u5b58\u4e2d\u5b58\u50a8\u7684\u5b57\u8282\u6570<br \/>\nvalue \u5b58\u50a8\u7684\u503c&#xff08;\u59cb\u7ec8\u4f4d\u4e8e\u7b2c\u4e8c\u884c&#xff09;<\/p>\n<p>#\u589e\u52a0key&#xff0c;\u8fc7\u671f\u65f6\u95f4\u4e3a\u79d2&#xff0c;bytes\u4e3a\u5b58\u50a8\u6570\u636e\u7684\u5b57\u8282\u6570<br \/>\nadd key flags exptime bytes<\/p>\n<p>\u4f8b\u5b50&#xff1a;<\/p>\n<p> [root&#064;tomcata ~]# telnet localhost 11211<br \/>\nTrying ::1&#8230;<br \/>\nConnected to localhost.<br \/>\nEscape character is &#039;^]&#039;.<br \/>\nadd leekey 0 60 4<br \/>\ntest<br \/>\nSTORED<\/p>\n<p>add leekey1 0 60 3<br \/>\nlee<br \/>\nSTORED<\/p>\n<p># \u67e5\u770b<br \/>\nget leekey<br \/>\nVALUE leekey 0 4<br \/>\ntest<br \/>\nEND<\/p>\n<h2 id=\"4.session%20%E5%85%B1%E4%BA%AB%E6%9C%8D%E5%8A%A1%E5%99%A8\" style=\"background-color:transparent\"><span style=\"color:#333333\">4.session <\/span><span style=\"color:#333333\">\u5171\u4eab\u670d\u52a1\u5668<\/span><\/h2>\n<h3 id=\"4.1%20msm%E4%BB%8B%E7%BB%8D\">4.1 msm\u4ecb\u7ecd<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"327\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815002000-689e7d30109dc.png\" width=\"978\" \/><\/p>\n<p><span style=\"color:#333333\">msm<\/span><span style=\"color:#333333\">&#xff08;<\/span><span style=\"color:#333333\">memcached session manager<\/span><span style=\"color:#333333\">&#xff09;\u63d0\u4f9b\u5c06<\/span><span style=\"color:#333333\">Tomcat<\/span><span style=\"color:#333333\">\u7684<\/span><span style=\"color:#333333\">session<\/span><span style=\"color:#333333\">\u4fdd\u6301\u5230<\/span><span style=\"color:#333333\">memcached<\/span><span style=\"color:#333333\">\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u53ef\u7528\u3002 <\/span><\/p>\n<p><span style=\"color:#333333\">\u9879\u76ee\u65e9\u671f\u6258\u7ba1\u5728<\/span><span style=\"color:#333333\">google code,<\/span><span style=\"color:#333333\">\u76ee\u524d\u5728<\/span><span style=\"color:#333333\">Github<\/span><\/p>\n<\/p>\n<h3 id=\"4.2%20%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE\">4.2 \u5b89\u88c5\u4e0e\u914d\u7f6e<\/h3>\n<p>&#xff08;1&#xff09;\u628a\u9700\u8981\u7684jar\u5305&#xff0c;\u4ece\/mnt\/\u4e0b\u653e\u5230\/usr\/local\/tomcat\/lib\u8be5\u76ee\u5f55\u4e0b&#xff08;\u4e24\u53f0tomcat\u90fd\u505a&#xff09;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"309\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815002000-689e7d303730c.png\" width=\"713\" \/><\/p>\n<p> [root&#064;tomcatb mnt]# unzip jar.zip<br \/>\n[root&#064;tomcatb mnt]# ls<br \/>\napache-tomcat-9.0.107.tar.gz  hgfs  jar  jar.zip<br \/>\n[root&#064;tomcatb mnt]# cd jar\/<br \/>\n[root&#064;tomcatb jar]# cp * \/usr\/local\/tomcat\/lib\/ <\/p>\n<p>&#xff08;2&#xff09;\u8ffd\u52a0tomcat\u914d\u7f6e<\/p>\n<p> a\u7684\u914d\u7f6e&#xff1a;<br \/>\n[root&#064;tomcata jar]# vim \/usr\/local\/tomcat\/conf\/context.xml<\/p>\n<p>&lt;Manager className&#061;&#034;de.javakaffee.web.msm.MemcachedBackupSessionManager&#034;<br \/>\n        memcachedNodes&#061;&#034;n1:172.25.254.10:11211,n2:172.25.254.20:11211&#034;<br \/>\n        failoverNodes&#061;&#034;n1&#034;<br \/>\n        requestUriIgnorePattern&#061;&#034;.*\\\\.(ico|png|gif|jpg|css|js)$&#034;<br \/>\n        transcoderFactoryClass&#061;&#034;de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory&#034;<br \/>\n    \/&gt;<\/p>\n<p>b\u7684\u914d\u7f6e&#xff1a;<br \/>\n[root&#064;tomcatb lib]# vim \/usr\/local\/tomcat\/conf\/context.xml<\/p>\n<p>&lt;Manager className&#061;&#034;de.javakaffee.web.msm.MemcachedBackupSessionManager&#034;<br \/>\n        memcachedNodes&#061;&#034;n1:172.25.254.10:11211,n2:172.25.254.20:11211&#034;<br \/>\n        failoverNodes&#061;&#034;n2&#034;<br \/>\n        requestUriIgnorePattern&#061;&#034;.*\\\\.(ico|png|gif|jpg|css|js)$&#034;<br \/>\n        transcoderFactoryClass&#061;&#034;de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory&#034;<br \/>\n    \/&gt;<\/p>\n<p># \u505a\u5b8c\u91cd\u542f\u670d\u52a1<br \/>\nsystemctl restart memcached.service <\/p>\n<p><span style=\"color:#fe2c24\">a&#xff1a;<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"483\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815002000-689e7d304cfe2.png\" width=\"1146\" \/><\/p>\n<p><span style=\"color:#fe2c24\">b&#xff1a;<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"483\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815002000-689e7d309416f.png\" width=\"1137\" \/><\/p>\n<p>\u6d4b\u8bd5&#xff1a;<\/p>\n<p>\u73b0\u5728\u670d\u52a1\u662f\u5728tomcata\u4e0a&#xff0c;\u5199\u5165\u6570\u636e&#xff0c;\u6570\u636e\u6b63\u5e38<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"396\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815002001-689e7d3102728.png\" width=\"807\" \/><\/p>\n<p>\u628atomcata\u505c\u6389<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"255\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815002001-689e7d312bfad.png\" width=\"1173\" \/><\/p>\n<p>\u4e0d\u5237\u65b0&#xff0c;\u7ee7\u7eed\u63d0\u4ea4\u65b0\u7684\u4fe1\u606f&#xff0c;\u5b83\u4f1a\u81ea\u52a8\u8f6c\u5230tomcatb\u4e0a&#xff0c;\u5e76\u4e14\u6570\u636e\u4fdd\u7559<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"402\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815002001-689e7d3166569.png\" width=\"702\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb827\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf14\u6b21\u3002msm\uff09\u63d0\u4f9b\u5c06Tomcat\u7684session\u4fdd\u6301\u5230memcached\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u53ef\u7528\u3002\u9879\u76ee\u65e9\u671f\u6258\u7ba1\u5728\u76ee\u524d\u5728Github\u3002<\/p>\n","protected":false},"author":2,"featured_media":57149,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[223,763,43],"topic":[],"class_list":["post-57166","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-tomcat","tag-763","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT-\u76f8\u5173\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/57166.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT-\u76f8\u5173\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb827\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf14\u6b21\u3002msm\uff09\u63d0\u4f9b\u5c06Tomcat\u7684session\u4fdd\u6301\u5230memcached\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u53ef\u7528\u3002\u9879\u76ee\u65e9\u671f\u6258\u7ba1\u5728\u76ee\u524d\u5728Github\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/57166.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-15T00:20:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001956-689e7d2c8e1c7.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57166.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/57166.html\",\"name\":\"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT-\u76f8\u5173\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-15T00:20:02+00:00\",\"dateModified\":\"2025-08-15T00:20:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/57166.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/57166.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57166.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT---\u76f8\u5173\u90e8\u7f72\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT-\u76f8\u5173\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/57166.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT-\u76f8\u5173\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb827\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf14\u6b21\u3002msm\uff09\u63d0\u4f9b\u5c06Tomcat\u7684session\u4fdd\u6301\u5230memcached\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u53ef\u7528\u3002\u9879\u76ee\u65e9\u671f\u6258\u7ba1\u5728\u76ee\u524d\u5728Github\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/57166.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-15T00:20:02+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815001956-689e7d2c8e1c7.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/57166.html","url":"https:\/\/www.wsisp.com\/helps\/57166.html","name":"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT-\u76f8\u5173\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-15T00:20:02+00:00","dateModified":"2025-08-15T00:20:02+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/57166.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/57166.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/57166.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4f01\u4e1a\u7ea7WEB\u5e94\u7528\u670d\u52a1\u5668TOMCAT---\u76f8\u5173\u90e8\u7f72"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=57166"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57166\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/57149"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=57166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=57166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=57166"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=57166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}