Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Debian 8 (amd64) installation deployment Memcached management tools MemAdmin     - Advanced network security tips Linux backdoor Technology and Practice (Linux)

- Delete specific files using bash directory under Linux (Linux)

- Linux Learning Notes: Users and Groups (Linux)

- Linux fast set ip bond (Linux)

- Linux, MySQL root privilege escalation another method (Linux)

- CentOS7 installed MySQL (Database)

- Type Linux commands (Linux)

- NIC configuration parameters under Linux (Linux)

- Ubuntu install Lighttpd + Mono support .net (Linux)

- Thinking in Java study notes - initialization and cleanup (Programming)

- Linux group account deletion, and other related operations (Linux)

- Linux Platform Oracle 11g Single Instance Installation Deployment Configuration Quick Reference (Database)

- Python developer of time-saving method (Programming)

- Oracle user lock how to know what causes (Database)

- Supervisor Installation and Configuration (Server)

- Why I do not like the Go language style interface (ie Structural Typing) (Programming)

- Ubuntu FAQ solutions (Linux)

- Drawing from the Android source code analysis View (Programming)

- Struts2 interceptor simulation (Programming)

- Linux installation notes under GAMIT (Linux)

 
         
  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:      
 
- Oracle how to maintain the consistency of read? (Database)
- Oracle bdump file soaring (Database)
- Linux system security infrastructure Highlights (Linux)
- Struts2 Result Types (Programming)
- Present Situation and Development Trend of firewall products (Linux)
- Linux operating system security management skills notes (Linux)
- Oracle archive log summary (Database)
- View processes and threads under Linux (Linux)
- Service Discovery: Zookeeper vs etcd vs Consul (Server)
- Security Knowledge: How to hide a backdoor PHP file tips (Linux)
- RHEL5.8 physical opportunities to Read-only file system (Linux)
- apt-get install openstack pkg Troubleshooting (Linux)
- Python Multithreaded Programming (Programming)
- CentOS 6.6 install rsync server (Server)
- Secondary exponential smoothing prediction method implemented in Python (Programming)
- Linux5 install MySQL 5.6 (RPM mode) (Database)
- MySQL monitoring tools -orzdba (Database)
- How to fix fatal error: security / pam_modules.h: No such file or directory (Linux)
- High-performance JavaScript DOM programming (Programming)
- Linux crontab command format example (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.