Installation
Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » https://pecl.php.net/package/tokyo_tyrant
Configure options
- --with-tokyo-tyrant[=DIR] DIR is the prefix to the Tokyo Tyrant installation
- --with-tokyo-cabinet-dir[=DIR] DIR is the prefix to the Tokyo Cabinet installation
- --disable-tokyo-tyrant-session Disable Tokyo Tyrant session handler support
Enabling the extension
The extension can be enabled by adding extension=tokyo_tyrant.so to the INI-configuration
Running Tokyo Tyrant for the session handler
ttserver -port 2000 -ext /path/to/expire.lua -extpc expire 30.0 '/tmp/sessions.tct#idx=ts:dec'
Note: expire.lua is included in the tokyo_tyrant extension source distribution
Configuring session handler
- tokyo_tyrant.session_salt="randomlongstring"
- session.save_handler=tokyo_tyrant
- session.save_path="tcp://hostname1:2000,tcp://hostname2:2000"
Note: It is important to make sure that tokyo_tyrant.session_salt matches on all servers.
How it works?
The session handler creates a session id like the following: 8b0e27a823fa4a6cf7246945b82c1d51-a5eadbbed1f2075952900628456bfd6830541629-0-5460
The parts from left to right:
- Session id - Generated session id
- Checksum - Checksum of session salt, session id, node id and primary key
- Node id - The id of the node where the session maps to
- Primary key - The primary key of the row where the session is stored
The checksum contains SHA1 sum of the node id, primary key, session id and the salt which is known only on the server side. This allows quick mapping of session id to node and primary key since there is no need to do an additional search. During session id regeneration only the parts 1 and 2 change but the mapping to the node and primary key stays constant.
In case some of the nodes fail tokyo_tyrant.allow_failover, tokyo_tyrant.fail_threshold and tokyo_tyrant.health_check_divisor INI-settings control the behavior during failover. If failover is allowed the session handler will map the session to a healthy node and creates a new empty session.
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-tokyo-tyrant.installation.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.