Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Debian 8 (amd64) installation deployment Memcached management tools MemAdmin     - CentOS 6.5 install Maven and Nexus warehouse agent (Server)

- To install CentOS 6.5 on your hard drive under Windows 7 (Linux)

- PyCharm new Python file name and the name of the module will import the same problem might arise (Programming)

- Math objects easily overlooked but very convenient method --JavaScript (Programming)

- Linux Firewall Builder shorewall (Linux)

- Root of AVL Tree- achieve balanced search trees AVL tree (Programming)

- Linux system commands to view hardware information (Linux)

- JEdit 5.2 Pro Edition installation on Ubuntu 14.04 (Linux)

- How to query the role of Linux services (Linux)

- Android SDK Manager can not update the domestic solutions (Linux)

- Oracle database NUMBER (x, y) data types (Database)

- Safe learning through self-extracting package to achieve invasion (Linux)

- Use Android Studio and Gradle packaged multi-version APK (Programming)

- Oracle table space is too large processing time (Database)

- Construction of Android and iOS apps use Jenkins Automation (Programming)

- How to view the Linux program or process used in the library (Linux)

- MySQL and Oracle time zone settings compare (Database)

- CentOS 6.5 boot automatically mount the hard drive (Linux)

- Debian SSD ext4 4K aligned (Linux)

- MySQL loose index scan (Database)

 
         
  Debian 8 (amd64) installation deployment Memcached management tools MemAdmin
     
  Add Date : 2018-11-21      
         
         
         
  Table of Contents
1, memadmin intro
2, nginx acand php installation environment
3, memadmin Tool Deployment
4, the use of simple tools memadmin
5, additional configuration optimization
6, summary

1, memadmin intro
MemAdmin Memcached is a visual management and monitoring tool that uses PHP development, small size, simple operation.
The main function:
Server parameter monitoring: STATS, SETTINGS, ITEMS, SLABS, SIZES refreshed in real time
Server Performance Monitoring: GET, DELETE, INCR, DECR, CAS and other common operations hit rate real-time monitoring
Support data traverse, easy to store content monitoring
Supports conditional queries, selected to meet the conditions KEY or VALUE
Arrays, JSON serialization and other anti-character sequence display
Other services memcache compatible protocol, such as Tokyo Tyrant (except traversal)
Server connection pooling support, multi-server management simple and convenient switch

2, nginx and php installation environment

2.1, install nginx
1234567 root @ com: ~ # uname -r
3.16.0-4-amd64
root @ com: ~ # cat / etc / issue
Debian GNU / Linux 8 n l
root @ test1: ~ # apt-get install nginx
root @ test1: ~ # chkconfig --list nginx
nginx 0: off 1: off 2: on 3: on 4: on 5: on 6: off
2.2, php deployment environment
root @ test1: ~ # apt-get install php5-fpm
root @ test1: ~ # dpkg -L php5-fpm
/.
/ Etc
/ Etc / php5
/ Etc / php5 / fpm
/etc/php5/fpm/conf.d
/etc/php5/fpm/pool.d
/etc/php5/fpm/pool.d/www.conf # This is the configuration file php5-fpm
/etc/php5/fpm/php-fpm.conf
/etc/logrotate.d
/etc/logrotate.d/php5-fpm
/ Etc / init
/etc/init/php5-fpm.conf
/etc/init.d
/etc/init.d/php5-fpm
/ Usr
/ Usr / sbin
/ Usr / sbin / php5-fpm
/ Usr / lib
/ Usr / lib / php5
/ Usr / lib / php5 / 20131226
/ Usr / lib / php5 / php5-fpm-checkconf
/ Usr / lib / php5 / php5-fpm-reopenlogs
/ Usr / share
/ Usr / share / man
/ Usr / share / man / man8
/usr/share/man/man8/php5-fpm.8.gz
/ Usr / share / lintian
/ Usr / share / lintian / overrides
/ Usr / share / lintian / overrides / php5-fpm
/ Usr / share / php5
/ Usr / share / php5 / sapi
/ Usr / share / php5 / sapi / fpm
/ Usr / share / bug
/ Usr / share / bug / php5-fpm
/ Usr / share / bug / php5-fpm / script
/ Usr / share / bug / php5-fpm / control
/ Usr / share / doc
/ Lib
/ Lib / systemd
/ Lib / systemd / system
/lib/systemd/system/php5-fpm.service
/ Usr / share / doc / php5-fpm

root @ test1: ~ # vim /etc/php5/fpm/pool.d/www.conf
#listen = /var/run/php5-fpm.sock comment this line, this is not necessary, but I used to make php5-fpm listening on a port instead sock
listen = 9000 to increase this exercise php5-fpm listening port in 9000
root @ test1: ~ # /etc/init.d/php5-fpm restart
[Ok] Restarting php5-fpm (via systemctl): php5-fpm.service.
root @ test1: ~ # ss -tnl | grep 9000
LISTEN 0 128 *: 9000 *: *

root @ test1: ~ # vim / etc / nginx / sites-enabled / default
# Modify nginx configuration so that it can forward the request to the php php5-fpm, in "#location ~ .php $ {" add the following code below the code block:
      location ~ .php $ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME / var / www / html $ fastcgi_script_name;
                include fastcgi_params;
        }
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root @ test1: ~ # vim /var/www/html/info.php
< ? Php
    phpinfo ();
? >
root @ test1: ~ # nginx -t
root @ test1: ~ # /etc/init.d/nginx restart
[Ok] Restarting nginx (via systemctl): nginx.service.
3, memadmin tool to deploy and simple to use

123456 root @ test1: ~ # ls
memadmin-1.0.12.tar.gz
root @ test1: ~ # tar xf memadmin-1.0.12.tar.gz -C / var / www / html /
root @ test1: ~ # cd / var / www / html /
root @ test1: / var / www / html # ls
index.nginx-debian.html info.php memadmin
Being given, according to the error prompts to install memcache extension support:
root @ test1: / var / www / html # apt-get install php5-memcache
root @ test1: / var / www / html # dpkg -L php5-memcache
/.
/ Usr
/ Usr / lib
/ Usr / lib / php5
/ Usr / lib / php5 / 20131226
/usr/lib/php5/20131226/memcache.so # library file here
/ Usr / share
/ Usr / share / doc
/ Usr / share / doc / php5-memcache
/ Usr / share / doc / php5-memcache / examples
/usr/share/doc/php5-memcache/examples/memcache.php.gz
/usr/share/doc/php5-memcache/examples/example.php
/usr/share/doc/php5-memcache/changelog.Debian.gz
/ Usr / share / doc / php5-memcache / copyright
/usr/share/doc/php5-memcache/memcache.php.gz
/usr/share/doc/php5-memcache/changelog.gz
/usr/share/doc/php5-memcache/package.xml.gz
/usr/share/doc/php5-memcache/README.gz
/ Usr / share / doc / php5-memcache / CREDITS
/usr/share/doc/php5-memcache/example.php
/ Usr / share / php
/usr/share/php/.registry
/usr/share/php/.registry/.channel.pecl.php.net
/usr/share/php/.registry/.channel.pecl.php.net/memcache.reg
/ Etc
/ Etc / php5
/ Etc / php5 / mods-available
/etc/php5/mods-available/memcache.ini

root @ test1: / var / www / html # vim /etc/php5/fpm/php.ini
# Search for "extension" keyword in "; extension_dir =" ext "" By increasing the code below
extension_dir = "/ usr / lib / php5 / 20131226"
extension = memcache.so
root @ test1: / var / www / html # /etc/init.d/php5-fpm restart
[Ok] Restarting php5-fpm (via systemctl): php5-fpm.service.
So far, memadmin tools deployed.
4, the use of simple tools memadmin

The default tool when memadmin Username and password are admin, you can make changes in the configuration file, as follows:
root @ test1: / var / www / html # pwd
/ Var / www / html
root @ test1: / var / www / html # vim memadmin / config.php
if (! defined ( 'IN_MADM')) exit ();
$ Config [ 'user'] = "admin"; // your username
$ Config [ 'passwd'] = "admin"; // your password
.........
5, additional configuration optimization

    Now, we can enjoy the use memadmin this tool, but the main function of the server is to provide memcached service, but only one pair of memcached memadmin management tool only, frequency of use is not particularly high, so allocated to nginx, php5- fpm resources can only take a little, especially in your server resources are more tense situation should nginx and php5-fpm both services optimization.
5.1, nginx optimization
    Let's look at the default nginx operating characteristics, as follows:
root @ test1: ~ # pgrep nginx
11748
11750
11751
11752
11753
root @ test1: ~ # ps aux | grep nginx
root 11748 0.0 0.3 91172 3064 Ss 12:25 0:00 nginx:? master process / usr / sbin / nginx -g daemon on; master_process on;
www-data 11750 0.0 0.4 91816 4776 S 12:25 0:01 nginx:? worker process
www-data 11751 0.0 0.4 91828 5028 S 12:25 0:00 nginx:? worker process
www-data 11752 0.0 0.3 91476 3752 S 12:25 0:01 nginx:? worker process
www-data 11753 0.0 0.3 91476 3752 S 12:25 0:01 nginx:? worker process
root 12909 0.0 0.2 12948 2196 pts / 1 S + 15:53 ​​0:00 grep nginx
When the # default, nginx has a main process, four worker processes

1234 root @ test1: ~ # ss -tnl | grep 80
LISTEN 0 128 *: 80 *: *
LISTEN 0 128 ::: 80 ::: *
When the # default, nginx listen address of IPV6

I am here for the environment, nginx only need to open the process to a worker, listening to IPV6 addresses is not necessary, so the following modifications:
root @ test1: ~ # find / etc / nginx / * -type f | xargs grep "worker_processes"
/etc/nginx/nginx.conf:worker_processes 4;
root @ test1: ~ # vim /etc/nginx/nginx.conf
worker_processes 1; # changed to "1"
root @ test1: ~ # find / etc / nginx / * -type f | xargs grep "listen 80"
/ Etc / nginx / sites-available / default: listen 80 default_server;
/ Etc / nginx / sites-available / default: #listen 80;
root @ test1: ~ # vim / etc / nginx / sites-available / default
.....
server {
        listen 80 default_server;
        #listen [::]: 80 default_server; # Comment this line
root @ test1: ~ # nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root @ test1: ~ # /etc/init.d/nginx reload
[Ok] Reloading nginx configuration (via systemctl): nginx.service.
Optimized results are as follows:
root @ test1: ~ # ps aux | grep nginx
root 11748 0.0 0.4 91280 5000 Ss 12:25 0:00 nginx: master process / usr / sbin / nginx -g daemon on; master_process on;?
www-data 13031 0.0 0.3 91600 3808 S 16:00 0:00 nginx:? worker process
root 13052 0.0 0.2 12948 2064 pts / 1 S + 16:01 0:00 grep nginx
root @ test1: ~ # ss -tnl | grep 80
LISTEN 0 128 *: 80 *: *

5.2, php optimization

    Here optimized for php, we can control the number of worker processes php5-fpm to achieve the purpose of saving resources, beginning in "/etc/php5/fpm/php-fpm.conf" file is looking for a long time have not found any configuration options, and finally the use of powerful find command to locate the relevant profile.
    Let's look at php default starting number of processes:
root @ test1: ~ # ps aux | grep php
root 11946 0.0 1.3 93540 13996 Ss 12:32 0:01 php-fpm:? master process (/etc/php5/fpm/php-fpm.conf)
www-data 11949 0.0 1.0 94124 10720 S 12:32 0:00 php-fpm:? pool www
www-data 11950 0.0 1.1 93980 12088 S 12:32 0:00 php-fpm:? pool www
root 13124 0.0 0.2 12948 2204 pts / 1 S + 16:06 0:00 grep php

Default php also opened two work processes, there can be only one, do the following:

root @ test1: ~ # find / etc / php5 / * -type f | xargs grep "max_children" # Finding "max_children" keyword file
/etc/php5/fpm/pool.d/www.conf :; static - a fixed number (pm.max_children) of child processes;
/etc/php5/fpm/pool.d/www.conf :; pm.max_children - the maximum number of children that can
/etc/php5/fpm/pool.d/www.conf :; pm.max_children - the maximum number of children that
/etc/php5/fpm/pool.d/www.conf:pm.max_children = 5

About Php optimization has the following parameters:
pm, pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers
pm = dynamic # For dedicated servers, pm can be set to static.
# How to control the child process, options are static and dynamic. If you choose static, by pm.max_children specify a fixed number of child processes. If you choose dynamic, open by next parameter determines:
pm.max_children #, the maximum number of child processes
pm.start_servers #, the process starts when the number of
pm.min_spare_servers #, to ensure that the minimum number of idle processes, if the idle process is less than this value, then create a new child process
pm.max_spare_servers #, to ensure that the maximum number of idle processes, if the idle process is greater than this value, the clean up

Here, I set the value as follows:
root @ test1: ~ # vim /etc/php5/fpm/pool.d/www.conf
.....
pm pm = static # value to the static, dynamic defaults
pm.max_children = 1 # pm.max_clildren to change the value to "1", default is "5"
root @ test1: ~ # /etc/init.d/php5-fpm restart
[Ok] Restarting php5-fpm (via systemctl): php5-fpm.service.
root @ test1: ~ # ps aux | grep php-fpm
root 13235 0.0 1.3 93524 14016 Ss 16:29 0:00 php-fpm:? master process (/etc/php5/fpm/php-fpm.conf)
www-data 13238 0.0 0.6 93524 6428 S 16:29 0:00 php-fpm:? pool www
root 13258 0.0 0.1 12944 1984 pts / 1 S + 16:29 0:00 grep php-fpm
# Now there is only one php-fpm of the work process

Through observation, a nginx worker process takes about 4MB of memory, a php-fpm occupy approximately 6.5MB of memory, through the calculation of the optimization can save memory = 4MB * 4 + 6.5 = 22.5MB memory size.

6, summary

Now the company's system environment to slowly migrate from the Debian CentOS, Debian no contact from the system for me, but also a process of adaptation, this time through the use of discovery in the use of Debian and Centos there are many different, we encountered some problems when the php built environment.

MemAdmin Chinese interface, the operation is very simple, but I found several problems in use, such as: only write data, but can not read data, refresh time interval when the status monitor does not take effect and the like.

There is also a simple memcached status monitoring tool is also good, called memcachephp-master, can achieve access to the KEY corresponding to the VALUE value, just to make me MemAdmin not get less value. This tool is very simple to deploy, no longer demo here.
     
         
         
         
  More:      
 
- To batch create users under Linux (Linux)
- MongoDB learning Notes (2) basic connection example of -Nodejs and MongoDB (Database)
- Spark read more HBase tables a RDD (Server)
- Setting up Linux machine through a proxy firewall (Linux)
- Ubuntu PPA install SMPlayer 14.9 (Linux)
- C ++ virtual functions Classic Insights (Programming)
- Disk Management LVM (Linux)
- Python Socket Network Programming (Programming)
- Linux systems for entry-learning: Install closed-source packages in Debian (Linux)
- 6 common PHP security attacks (Linux)
- How to experience Unity 8 Mir on Ubuntu 16.04 (Linux)
- Sublime Text Add instructions to insert the current time zone (Linux)
- Java string intern constant pool resolution Introduction (Programming)
- Introduction and use of the Raspberry Pi (Linux)
- CentOS 6.4 of cron scheduled task configuration (Linux)
- How Ubuntu Snappy Core 2 running on Raspberry Pi (Linux)
- CentOS7 management of systemd (Linux)
- How a lot of blocking malicious IP address in Linux (Linux)
- Build Python3.4 + PyQt5.3.2 + Eric 6.0 development platform Ubuntu 14.04 (Server)
- SQL Server memory Misunderstanding (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.