Samsung world's first mixed digital SLR camera system-NX system for a long time brewing, perhaps due to external factors (avoid with Panasonic GF-1 Olympus E-P2 and other micro 43 models caused positive
Samsung's world's first mixed digital SLR camera system-NX system after a long brewing, perhaps due to external factors (avoid with Panasonic GF-1/OLYMPUS E-P2 and other micro 4/3 models caused positive
How to Get Discuz recently! Apply Memcache to do some things and record the Memcache installation process.
The detailed method is as follows:
1. Download memcached and libevent respectively and put them in the/tmp directory:
# Cd/tmp
# Wget
# Wget ~ Provos/libevent-1.2.tar.gz
2. Install libevent first:
# Tar zxvf libevent-1.2.tar.gz
# Cd libevent-1.2
#./Configure-prefix =/usr/local
# Make
# Make install
3. test whether the libevent is successfully installed:
# Ls-al/usr/local/lib | grep libevent
Lrwxrwxrwx 1 root 21 11 ?? Libevent-1.2.so.1> libevent-1.2.so.1.0.3
-Rwxr-xr-x 1 root 263546 11 ?? Libevent-1.2.so.1.0.3
-Rw-r-1 root 454156 11 ?? 12 libevent.
-Rwxr-xr-x 1 root 811 11 ?? Libevent. la
Lrwxrwxrwx 1 root 21 11 ?? 12 libevent. so-> libevent-1.2.so.1.0.3
Not bad. They all have been installed.
4. Install memcached and specify the libevent installation location during installation:
# Cd/tmp
# Tar zxvf memcached-1.2.0.tar.gz
# Cd memcached-1.2.0
#./Configure -- with-libevent =/usr/local
# Make
# Make install
If an error is reported in the middle, check the error information carefully and configure or add the corresponding library or path according to the error information.
After the installation is complete, the memcached will be placed in/usr/local/bin/memcached,
5. Test whether memcached is successfully installed:
# Ls-al/usr/local/bin/mem *
-Rwxr-xr-x 1 root 137986 11 ?? 12 :39/usr/local/bin/memcached
-Rwxr-xr-x 1 root 140179 11 ?? 12 :39/usr/local/bin/memcached-debug
Install the PHP extension of Memcache (skip this step if you do not use PHP)
1. Select the desired memcache version.
2. Install memcache extension for PHP
Tar vxzf memcache-2.2.1.tgz
Cd memcache-2.2.1
/Usr/local/php/bin/phpize
./Configure-enable-memcache-with-php-config =/usr/local/php/bin/php-config-with-zlib-dir
Make
Make install
3. A message similar to this will appear after the above installation:
Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/
4. Modify extension_dir = "./" in php. ini
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx /"
5. Add a row to load the memcache extension: extension = memcache. so
Basic settings of memcached:
1. Start the Memcache Server:
#/Usr/local/bin/memcached-d-m 10-u root-l 192.168.0.200-p 12000-c 256-P/tmp/memcached. pid
-D option is to start a daemon,
-M indicates the amount of memory allocated to Memcache. The unit is MB. Here I am 10 MB,
-U is the user who runs Memcache. Here I am root,
-L is the IP address of the listening server. If there are multiple IP addresses, I have specified the IP address 192.168.0.200,
-P is the port for Memcache listening. I have set port 12000 here, preferably port 1024 or above,
-The "c" option is the maximum number of concurrent connections. The default value is 1024. I have set 256 here, which is based on the load of your server,
-P is the pid file for saving Memcache. Here I save it in/tmp/memcached. pid,
2. to end the Memcache process, run:
# Kill 'cat/tmp/memcached. Pi'
You can also start multiple daemon processes, but the ports cannot be repeated.
3. restart apache and service httpd restart
Test the Memcache environment:
Run the following PHP file. If This is a test! is output !, Indicates that the environment is successfully set up. Start to appreciate the charm of Memcache!
<? Php
$ Mem = new Memcache;
$ Mem-> connect ("127.0.0.1", 11211 );
$ Mem-> set ('key', 'This is a test! ', 0, 60 );
$ Val = $ mem-> get ('key ');
Echo $ val;
?>
The command for starting my memcache is:
./Memcached-d-m 64-u root-l 10.1.2.135-p 11211-c 256-P/tmp/memcached. pid
./Memcached-d-m 64-u root-l 10.1.2.135-p 11212-c 256-P/tmp/memcached. pid
./Memcached-d-m 64-u root-l 10.1.2.135-p 11213-c 256-P/tmp/memcached. pid
Among them, 10 .. 1.2.135 is the address of the memcache server. Multiple mem daemon processes can be started to cache data at the same time, but the port numbers cannot be the same.
I also encountered a problem when installing memcache:
/Usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
It mainly looks at the error prompted in the last line, so we:
The following is a code snippet:
Ln-s/usr/local/lib/libevent-1.4.so.2/usr/lib/libevent-1.4.so.2
Ldconfig
Run it again.