Site Cluster Solution--nginx+tomcat session sharing scenario Linux PHP session sessionfactory session loss

Source: Internet
Author: User
Tags php session
Specific configuration and Tomcat under the same, please refer to:

Http://note.youdao.com/share/?id=e486a2e17eefbfab6f227dc9dddd0cef&type=note

Here are some notes:

One

Tomcat cluster and load balancing implementation (session synchronization) Supplement

Because the session Sync feature of Tomcat requires multicast, Windows is enabled by default for multicast, but Linux is not enabled by default.

You can open the route add-net 224.0.0.0 netmask 240.0.0.0 dev eth0 #eth0,eth1,eth2 by instruction ... Represents a NIC, Nic two , Nic three

Use: Route add-net 224.0.0.0 netmask 240.0.0.0 Dev lo #这个代表本机, eth0,eth1,eth2 ... if the following conditions are met Represents Nic one, Nic two, Nic three ... lo stands for 127.0.0.1, or localhost

1) Receiver's address is auto

2) Multiple Tomcat of this machine do cluster

If you need to open multicast when the server is started, you need to include eht0 net 224.0.0.0 netmask 240.0.0.0 in the/etc/sysconfig/static-routes file.

For specific multicast concepts, please refer to CCNP related content.

Two

I generally refer to the project release (Hot Deployment), in the Server.xml c/> can also be added.

[HTML] view Plaincopy

    1. < Context path="" docBase="D:\apache-tomcat-6.0.35\logintest1" reloadable= "true" distributable="true" />

Three

In the Server.xml element

[HTML] view Plaincopy

    1. < Receiver className="Org.apache.catalina.tribes.transport.nio.NioReceiver"
    2. Address="Auto"
    3. Port="The "
    4. selectortimeout="+"
    5. maxthreads="6"/>

Where address is written as auto, many times the server will automatically use 127.0.0.1, which will cause problems, so when the server does not automatically read the local LAN IP, we manually set up a bit, such as: 192.168.0.2, so a contest with auto insurance.

Four

Server.xml we add some of the content part of the specific meaning and trial, the official has a description, reference can be.

The above describes the site cluster solution--nginx+tomcat session sharing program Linux, including the session,tomcat aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.