In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
one。 Selection and introduction of open source software 1.Tengine
Introduction: Tengine is a Web server project initiated by Taobao. On the basis of Nginx, it adds a lot of advanced functions and features to meet the needs of high-volume websites. The performance and stability of Tengine have been well tested in large websites such as Taobao and Tmall Mall. Its ultimate goal is to create an efficient, stable, secure and easy-to-use Web platform. For more information, please see the official website.
Tengine official website: http://tengine.taobao.org/
Version selection: Tengine-2.2.0.tar.gz
Characteristics
-inherits all the features of Nginx-1.8.1 and is compatible with Nginx configuration
-dynamic module loading (DSO) support. Adding a module eliminates the need to recompile the entire Tengine
-supports HTTP/2 protocol, and HTTP/2 module replaces SPDY module
-streaming upload to HTTP backend server or FastCGI server to greatly reduce the Icano pressure on the machine.
-more powerful load balancing capabilities, including consistency hash module, session persistence module, active health check of back-end servers, automatic online and offline according to server status, and dynamic resolution of domain names in upstream
-input filter mechanism support. It is more convenient to write Web application firewall by using this mechanism.
-support setting the number of retries of proxy, memcached, fastcgi, scgi and uwsgi when the backend fails
-dynamic scripting language Lua support. The extension is very efficient and simple.
-support collecting Tengine running status by specified keywords (domain name, url, etc.)
-A request to combine multiple CSS and JavaScript files into a single request
-automatically remove white space characters and comments to reduce the size of the page
-automatically sets the number of processes and binding CPU affinity based on the number of CPU
-protect the system by monitoring the load and resource consumption of the system
-display error messages that are more friendly to operators, making it easy to locate faulty machines
-more powerful defense (access speed limit) module
-more convenient command line parameters, such as listing compiled modules, supported instructions, etc.
-Expiration time can be set according to the type of access file
2.MYSQL
Introduction: relational database management system, developed by MySQL AB Company of Sweden, currently belongs to Oracle Company. MySQL is the most popular relational database management system. MySQL is one of the best RDBMS (Relational Database Management System, relational database management system) applications in WEB applications. MySQL is an associated database management system that stores data in different tables instead of all data in a large warehouse, which increases speed and flexibility. The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts the dual licensing policy, which is divided into community version and commercial version. Because of its small size, high speed and low total cost of ownership, especially open source, the development of small and medium-sized websites generally choose MySQL as the website database. Because of the excellent performance of its community version, it can form a good development environment with PHP and Apache. The SQL language used by MySQL is the most commonly used standardized language for accessing databases. Since the data of our website is placed separately in the cluster and uses percon, we will not install the database here
3.PHP
Introduction: PHP (foreign name: PHP: Hypertext Preprocessor, Chinese name: "hypertext preprocessor") is a general open source scripting language. Grammar absorbs the characteristics of C language, Java and Perl, which is convenient for learning and widely used. It is mainly suitable for the field of Web development. PHP's unique syntax is a mix of C, Java, Perl, and PHP's own syntax. It can execute dynamic web pages faster than CGI or Perl. Compared with other programming languages, PHP embeds the program into HTML (an application under the standard general markup language) document to execute the dynamic page made by PHP, which is much more efficient than the CGI that completely generates HTML markup. PHP can also execute the compiled code, which can encrypt and optimize the code to run faster. Please refer to the official website for details.
PHP official website: http://www.php.net/
Select version: the last version of php-7.0.16.tar.gz 7.0and the latest version 7.1.2
Properties:
With the new version of the ZendEngine engine, there are many new features. Here is an incomplete list:
Performance improvement: PHP7 has two times better performance than PHP5.6. Improved performance: PHP 7 is up to twice as fast as PHP 5.6
Comprehensive and consistent 64-bit support. Consistent 64-bit support
Many fatal mistakes in the past have now been changed to throw exceptions. Many fatal errors are now Exceptions
Removed some old SAPI (server-side application programming ports) and extensions that are no longer supported. Removal of old and unsupported SAPIs and extensions
A null join operator has been added. The null coalescing operator (?
A new combination comparison operator has been added. Combined comparison Operator ()
The return type declaration of the function has been added. Return Type Declarations
New scalar type declaration has been added. Scalar Type Declarations
New anonymous classes are added. Anonymous Classes
two。 Environmental Overview 1. System environment
Centos6.8 mini version
two。 Network environment
192.168.10.2X
3. Hardware configuration
CPU:2 kernel MEM:2G DISK:100G
three。 Optimize the system environment 1. Tuning startup service
Close postfix:/etc/init.d/postfix stop & & chkconfig postfix off
Turn off the firewall: / etc/init.d/iptables stop & & chkconfig iptables off
Close SELINUX:sed-I's Universe GN'/ etc/selinux/config
two。 Tuning kernel system parameters
Sysctl-p
Parameters.
Meaning
Net.ipv4.ip_forward = 0
Turn on IP forwarding function
Net.ipv4.ip_default_ttl = 255,
Packet lifetime
Net.ipv6.conf.all.disable_ipv6 = 1
Net.ipv6.conf.default.disable_ipv6 = 1
Disable IPv6 for all interfaces, disable individual interfaces: net.ipv6.conf.eth0.disable_ipv6 = 1
Net.ipv4.conf.default.rp_filter = 1
Turn on reverse path filtering
Net.ipv4.conf.all.arp_ignore = 1
The source address is verified by reverse routing backtracking (defined in RFC1812).
This option is recommended for single hosts and stub network routers
Net.ipv4.conf.all.arp_announce = 2
Arp response (native ping does not have access to gateway)
Net.ipv4.conf.default.accept_source_route = 0
Packets that handle passive routin
Kernel.sysrq = 0
Disable the sysrq key (a gadget that allows you to control linux when you run out of memory)
Kernel.core_uses_pid = 1
Enable debugging of multithreaded applications
Kernel.msgmnb = 65536
The maximum sum of all messages in the message queue (msgmnb=64k)
Kernel.msgmax = 65536
Specifies the maximum value of messages in the message queue in the kernel (msgmax=64k)
Kernel.shmmax = 2147483648
Is one of the most important core parameters, used to define the maximum value of a single shared memory segment, 64-bit linux system:
The maximum preferred value is physical memory value-1byte. The recommended value is more than physical memory. Generally, the value is greater than SGA_MAX_SIZE, and you can take physical memory-1byte. For example,
If it is a 64GB physical memory, it can be taken as 64 "1024" 1024 "1024-1" 68719476735.
Kernel.shmall = 471859
This parameter controls the total number of pages of shared memory that can be used. Linux shared memory page size is 4KB, shared memory segment
The size is an integral multiple of the size of the shared memory page. The maximum size of a shared memory segment is 16G, so the number of pages of shared memory needs to be 16GB/4KB=16777216KB / 4KB=4194304 (pages), that is, 16GB physical memory under 64Bit system. Setting kernel.shmall = 4194304 meets the requirement (almost double the original setting of 2097152). Specifically, it can be set to 90% of memory.
3. Modify limit
Vim / etc/profile add a last line
Ulimit-u 10000
Ulimit-n 1024
Ulimit-d unlimited
Ulimit-m unlimited
Ulimit-s 10240
Ulimit-t unlimited
Ulimit-v unlimited
4. Restart 4 after tuning is complete. Install Tengine1. Download package installation package and dependent library
Wget http://tengine.taobao.org/download/tengine-2.2.0.tar.gz downloads the Tengine package
The rewrite function of wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tengine relies on the pcre library, and the latest is 8.40
Wget http://www.openssl.org/source/openssl-1.0.2.tar.gz installs ssl so that nginx supports https, with the latest version 1.1.0
Wget https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz installs the latest zlib support for compression
All of the above are used by nginx. You can add them to the update if any.
two。 Install pcre
Installation dependency: yum install gcc gcc-c++
Compile and install:. / configure-- prefix=/usr/local/pcre/ & & make & & make install
3. Install openssl
Compile and install. / config enable-shared-- prefix=/usr/local/openssl/ & & make & & make test & & make install
4. Install zlib
Decompress, compile, install:. / configure-- prefix=/usr/local/zlib & & make & & make install
5. Set up Tengine to run using users and groups
Groupadd web
Useradd-s / sbin/nologin-g web web
6. Compile and install Tengine
. / configure-- prefix=/usr/local/nginx\
-- user=web\
-- group=web\
-- with-pcre=/root/tar/pcre-8.39\
-- with-openssl=/root/tar/openssl-1.0.2\
-- with-zlib=/root/tar/zlib-1.2.11\
-- with-file-aio\ enable file aio support (an APL file transfer format)
-- with-http_gzip_static_module\ enable ngx_http_gzip_static_module support (online real-time compression of output data streams)
-- with-http_realip_module\ enable ngx_http_realip_module support (this module allows the client's IP address value to be changed from the request header, default is off)
-- with-http_stub_status_module\ enable ngx_http_stub_status_module support (get the working status of nginx since it was last started)
Make & & make install
7. Add administrative scripts and assign permissions
#! / bin/sh
#
# nginx-this script starts and stops the nginx daemon
#
# chkconfig:-85 15
# description: Nginx is an HTTP (S) server, HTTP (S) reverse\
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: / etc/nginx/nginx.conf
# config: / etc/sysconfig/nginx
# pidfile: / var/run/nginx.pid
# Source function library.
. / etc/rc.d/init.d/functions
# Source networking configuration.
. / etc/sysconfig/network
# Check that networking is up.
["$NETWORKING" = "no"] & & exit 0
Nginx= "/ usr/local/nginx/sbin/nginx"
Prog=$ (basename $nginx)
NGINX_CONF_FILE= "/ usr/local/nginx/conf/nginx.conf"
[- f / etc/sysconfig/nginx] & &. / etc/sysconfig/nginx
Lockfile=/var/lock/subsys/nginx
Make_dirs () {
# make required directories
User= `$ nginx-V 2 > & 1 | grep "configure arguments:" | sed's / [^ *] *-- user=\ ([^] *\). * /\ 1Uniple g'- `
If [- z "`grep $user / etc/ passwd`]; then
Useradd-M-s / bin/nologin $user
Fi
Options= `$ nginx-V 2 > & 1 | grep 'configure arguments:' `
For opt in $options; do
If [`echo $opt | grep'. *-temp-path' `]; then
Value= `echo $opt | cut-d "="-f 2`
If [!-d "$value"]; then
# echo "creating" $value
Mkdir-p $value & & chown-R $user $value
Fi
Fi
Done
}
Start () {
[- x $nginx] | | exit 5
[- f $NGINX_CONF_FILE] | | exit 6
Make_dirs
Echo-n $"Starting $prog:"
Daemon $nginx-c $NGINX_CONF_FILE
Retval=$?
Echo
[$retval-eq 0] & & touch $lockfile
Return $retval
}
Stop () {
Echo-n $"Stopping $prog:"
Killproc $prog-QUIT
Retval=$?
Echo
[$retval-eq 0] & & rm-f $lockfile
Return $retval
}
Restart () {
Configtest | | return $?
Stop
Sleep 1
Start
}
Reload () {
Configtest | | return $?
Echo-n $"Reloading $prog:"
Killproc $nginx-HUP
RETVAL=$?
Echo
}
Force_reload () {
Restart
}
Configtest () {
$nginx-t-c $NGINX_CONF_FILE
}
Rh_status () {
Status $prog
}
Rh_status_q () {
Rh_status > / dev/null 2 > & 1
}
Case "$1" in
Start)
Rh_status_q & & exit 0
, 1
Stop)
Rh_status_q | | exit 0
, 1
Restart | configtest)
, 1
Reload)
Rh_status_q | | exit 7
, 1
Force-reload)
Force_reload
Status)
Rh_status
Condrestart | try-restart)
Rh_status_q | | exit 0
*)
Echo $"Usage: $0 {start | stop | status | restart | condrestart | try-restart | reload | force-reload | configtest}"
Exit 2
Esac
Chmod 777 / etc/init.d/nginx
8. Set up a soft connection
Ln-s / usr/local/nginx/sbin/nginx / usr/local/bin/nginx
9. Set Boot self-boot
Chkconfig nginx on
five。 Install PHP1. Download the package
The latest version of wget http://cn2.php.net/get/php-7.0.16.tar.gz.asc/from/this/mirror php-7.0.16.tar.gz is 7.1.2 download stable version 7.0
two。 Installation dependency
Yum install libxml2 libxml2-devel libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel
3. Compilation and installation
. / configure-- prefix=/usr/local/php\
-- with-config-file-path=/usr/local/php/etc\
-- with-fpm-user=web\
-- with-fpm-group=web\
-- with-mysqli\
-- with-pdo-mysql\
-- with-iconv-dir\
-- with-freetype-dir\
-- with-jpeg-dir\
-- with-png-dir\
-- with-zlib\
-- with-libxml-dir=/usr\
-- with-curl-- enable-mbregex\
-- without-pear\
-- with-gettext\
-- with-openssl\
-- with-mhash\
-- with-xmlrpc\
-- enable-xml\
-- enable-fpm\
-- enable-bcmath\
-- enable-shmop\
-- enable-sysvsem\
-- enable-maintainer-zts\
-- enable-inline-optimization\
-- enable-pcntl\
-- enable-sockets\
-- enable-mbstring-- with-mcrypt\
-- enable-ftp-- with-gd\
-- enable-gd-native-ttf\
-- enable-zip\
-- enable-soap\
-- disable-rpath\
-- disable-ipv6\
-- disable-fileinfo\
Make & & make test & & make install
4. Configuration file
Cp php.ini-development / usr/local/php/lib/php.ini
Cp / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf
Cp / usr/local/php/etc/php-fpm.d/www.conf.default / usr/local/php/etc/php-fpm.d/www.conf
5. Set up a soft connection
Ln-s / usr/local/php/bin/php / usr/local/bin/php
Ln-s / usr/local/php/bin/php-config / usr/local/bin/php-config
Ln-s / usr/local/php/bin/phpize / usr/local/bin/phpize
6. Add administrative scripts and assign permissions
#! / bin/sh
# BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# Description: starts the PHP FastCGI Process Manager daemon
# END INIT INFO
Prefix=/usr/local/php
Exec_prefix=$ {prefix}
Php_fpm_BIN=$ {exec_prefix} / sbin/php-fpm
Php_fpm_CONF=$ {prefix} / etc/php-fpm.conf
Php_fpm_PID=$ {prefix} / var/run/php-fpm.pid
Php_opts= "- fpm-config $php_fpm_CONF-pid $php_fpm_PID"
Wait_for_pid () {
Try=0
While test $try-lt 35; do
Case "$1" in
'created')
If [- f "$2"]; then
Try=''
Break
Fi
'removed')
If [!-f "$2"]; then
Try=''
Break
Fi
Esac
Echo-n.
Try= `expr $try + 1`
Sleep 1
Done
}
Case "$1" in
Start)
Echo-n "Starting php-fpm"
$php_fpm_BIN-- daemonize $php_opts
If ["$?"! = 0]; then
Echo "failed"
Exit 1
Fi
Wait_for_pid created $php_fpm_PID
If [- n "$try"]; then
Echo "failed"
Exit 1
Else
Echo "done"
Fi
Stop)
Echo-n "Gracefully shutting down php-fpm"
If [!-r $php_fpm_PID]; then
Echo "warning, no pid file found-php-fpm is not running?"
Exit 1
Fi
Kill-QUIT `cat $php_fpm_ PID`
Wait_for_pid removed $php_fpm_PID
If [- n "$try"]; then
Echo "failed. Use force-quit"
Exit 1
Else
Echo "done"
Fi
Status)
If [!-r $php_fpm_PID]; then
Echo "php-fpm is stopped"
Exit 0
Fi
PID= `cat $php_fpm_ PID`
If ps-p $PID | grep-Q $PID; then
Echo "php-fpm (pid $PID) is running..."
Else
Echo "php-fpm dead but pid file exists"
Fi
Force-quit)
Echo-n "Terminating php-fpm"
If [!-r $php_fpm_PID]; then
Echo "warning, no pid file found-php-fpm is not running?"
Exit 1
Fi
Kill-TERM `cat $php_fpm_ PID`
Wait_for_pid removed $php_fpm_PID
If [- n "$try"]; then
Echo "failed"
Exit 1
Else
Echo "done"
Fi
Restart)
$0 stop
$0 start
Reload)
Echo-n "Reload service php-fpm"
If [!-r $php_fpm_PID]; then
Echo "warning, no pid file found-php-fpm is not running?"
Exit 1
Fi
Kill-USR2 `cat $php_fpm_ PID`
Echo "done"
*)
Echo "Usage: $0 {start | stop | force-quit | restart | reload | status}"
Exit 1
Esac
7. Add Boot Auto Boot
Chkconfig php-fpm on
six。 Install the PHP extension
1. Install the redis extension
Phpredis is an extension of php. It is quite efficient and has linked list sorting function. It is very useful for creating memory-level module business relationships.
Wget https://github.com/phpredis/phpredis/archive/php7.zip
Unzip php7.zip
Cd phpredis
/ usr/local/php/bin/phpize./configure-- with-php-config=/usr/local/php/bin/php-config edits the php.ini file and adds extension=redis.so2. Install the mongo extension
Wget https://pecl.php.net/get/mongodb-1.2.6.tgz
Tar zxvf mongodb-1.2.6.tgz
/ usr/local/php/bin/phpize
. / configure-- with-php-config=/usr/local/php/bin/php-config
Make
Make install
Edit the php.ini file to add extension=mongodb.so
Note:
Error report: configure: error: libssl not found!
Solution: yum-y install openssl-devel
3. Install the memcache extension
Wget https://pecl.php.net/get/memcache-3.0.8.tgz
Install MYSQL
Percina version: Percona-Server-5.6.26-74.0-r32f8dfd-el6-x86_64-bundle.tar
Get address: https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.33-79.0/binary/redhat/6/x86_64/Percona-Server-5.6.33-79.0-r2084bdb-el6-x86_64-bundle.tar
Install epel-release-6-8.noarch.rpm libaio-0.3.107-10.el6.x86_64.rpm
Install the dependency yum install-y gcc gcc-c++ make cmake automake autoconf libxml2 libxml2-devel zlib zlib-devel ncurses ncurses-devel
Then yum jemalloc / / tokuDB memory allocation needs jemalloc support
The installation sequence of Percona-Server-5.6.26-74.0-r32f8dfd-el6-x86_64-bundle.tar after decompression is as follows:
Tar xvf Percona-Server-5.6.26-74.0-r32f8dfd-el6-x86_64-bundle.tar
Rpm-ivh Percona-Server-shared-56-5.6.26-rel74.0.el6.x86_64.rpm
Rpm-ivh Percona-Server-devel-56-5.6.26-rel74.0.el6.x86_64.rpm
Rpm-ivh Percona-Server-client-56-5.6.26-rel74.0.el6.x86_64.rpm
Rpm-ivh Percona-Server-server-56-5.6.26-rel74.0.el6.x86_64.rpm
Rpm-ivh Percona-Server-tokudb-56-5.6.26-rel74.0.el6.x86_64.rpm
Modify system parameters
Echo never > / sys/kernel/mm/redhat_transparent_hugepage/defrag
Echo never > / sys/kernel/mm/redhat_transparent_hugepage/enabled
Echo never > / sys/kernel/mm/transparent_hugepage/enabled
Echo never > / sys/kernel/mm/transparent_hugepage/defrag
It is recommended to write it into / etc/rc.local, and it can also take effect after restart.
Start the service: / etc/init.d/mysql start
Modify the mysql configuration file vim / etc/my.cnf
Add default-storage-engine=TokuDB
Restart the service: / etc/init.d/mysql restart
Enter: ps_tokudb_admin-- enable-uroot-p password is not set to empty by default
Enter mysql and verify:
Attachment:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.