Eu tenho um site de big data (wordpress secondry desenvolver) um domínio www.example.com. Eu armazenei em 3 servidores.
In DNS setteing
IP address (IN A / AAAA) 46.192.22.01
IP address (IN A / AAAA) 46.192.22.02
IP address (IN A / AAAA) 46.192.22.03
- server1 46.192.22.01 / var / www / html - > / music & / video
- server2 46.192.22.02 / var / www / html - > / article & / foto
- server3 46.192.22.03 / var / www / html - > / products & / showroom
link
Timeout 45
KeepAlive Off
MaxKeepAliveRequests 256
KeepAliveTimeout 3
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 192
MaxClients 192
MaxRequestsPerChild 2500
</IfModule>
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
#LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule info_module modules/mod_info.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule substitute_module modules/mod_substitute.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule version_module modules/mod_version.so
ExpiresActive On
<FilesMatch "\.(jpg|jpeg)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
<FilesMatch "\.(css|png|js|gif)$">
ExpiresDefault "access plus 1 month"
</FilesMatch>
<ifmodule mod_deflate.c>
DeflateCompressionLevel 6
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
</ifmodule>
Servidor 1
ServerName www.example.com:80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass /article http://46.192.22.02/article retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /article http://46.192.22.02/article
ProxyPass /photo http://46.192.22.02/photo retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /photo http://46.192.22.02/photo
ProxyPass /products http://46.192.22.03/products retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /products http://46.192.22.03/products
ProxyPass /showroom http://46.192.22.03/showroom retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /showroom http://46.192.22.03/showroom
</VirtualHost>
server2
ServerName www.example.com:80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass /music http://46.192.22.01/music retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /music http://46.192.22.01/music
ProxyPass /video http://46.192.22.01/video retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /video http://46.192.22.01/video
ProxyPass /products http://46.192.22.03/products retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /products http://46.192.22.03/products
ProxyPass /showroom http://46.192.22.03/showroom retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /showroom http://46.192.22.03/showroom
</VirtualHost>
server3
ServerName www.example.com:80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass /music http://46.192.22.01/music retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /music http://46.192.22.01/music
ProxyPass /video http://46.192.22.01/video retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /video http://46.192.22.01/video
ProxyPass /products http://46.192.22.03/products retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /products http://46.192.22.03/products
ProxyPass /showroom http://46.192.22.03/showroom retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /showroom http://46.192.22.03/showroom
</VirtualHost>
todos os / etc / hosts são
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Então o arquivo .htaccess
servidor 1
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^music/track/(\d+)?$ music/track.php?number=$1
RewriteRule ^video/introduce/(\d+)?$ video/introduce.php?number=$1
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
servidor 2
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^article/introduce/(\d+)?$ article/introduce.php?number=$1
RewriteRule ^photo/products/(\d+)?$ photo/products.php?number=$1
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
servidor 3
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^products/smartphone/(\d+)?$ products/smartphone.php?number=$1
RewriteRule ^showroom/smartphone/(\d+)?$ showroom/smartphone.php?number=$1
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Mas quando eu abro http://www.example.com/products/smartphone/102034
é muito lento (3-5 segundos de atraso), mas http://46.192.22.03/products/smartphone/102034
é muito rápido (cerca de 0,2 segundos)
tail -50 /var/log/messages
logs de retorno como
Nov 18 11:46:20 dhclient[857]: DHCPACK from 46.192.22.01 (xid=0x6caa5cd9)
Nov 18 11:46:21 dhclient[857]: bound to 46.192.22.02 -- renewal in 1481 seconds.
Não sou bom em tecnologia de parte de servidor. Algum professor pode me ajudar a descobrir e consertar onde está o problema causa DNS muito lento? Obrigado.
UPDATE 1 (2014/11/23)
Durante 2 dias pesquisando, ainda não encontramos uma resposta. cada página loding precisa de cerca de 4 segundos de conexão que foi vista no console do Chrome. Se digitar ip em vez de domainn, apenas 0,2 a 1,4 segundos de conexão. Eu tinha desabilitado meu ipv6 em todos os 3 servidores, eu adicionei retry=1 acquire=3000 timeout=600 Keepalive=On
após ProxyPass
...
#dig example.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63728
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;example.com. IN A
;; ANSWER SECTION:
example.com. 7199 IN A 46.192.22.01
example.com. 7199 IN A 46.192.22.02
example.com. 7199 IN A 46.192.22.03
;; Query time: 121 msec
;; SERVER: 46.61.167.22#53(46.61.167.22)
;; WHEN: Sun Nov 23 20:51:03 2014
;; MSG SIZE rcvd: 81
Eu duvido que o proxy reverso seja realmente o que eu preciso? Hane eu encontrei um método errado para conectar meu servidor?
Na verdade, eu tenho 1 site com dados grandes, agora eu estou seprete em 3 centos6.6 64bit server (com 3 ips). cada servidor tem pasta única
- server1 46.192.22.01 / var / www / html - > / music & / video
- server2 46.192.22.02 / var / www / html - > / article & / foto
- server3 46.192.22.03 / var / www / html - > / products & / showroom
Portanto, não é um saldo de cluster ou de proxy, mas sim como definir (ou instalar outro software) para informar a Internet se alguém digitar " link "mapeará para o servidor 1; algum tipo " link " mapeará para o servidor 3 ... desculpe minha língua mãe não é o inglês, então eu nunca encontrei um caminho certo, até hoje, apenas o proxy reverso poderia satisfazer meus requerimentos.
Desculpe, eu só tenho um pouco de php, habilidade mysql, pouca habilidade apache centos, preciso de uma solução detalhada. Muito obrigado.
UPDATE 2 (2014/11/24)
Mais um dia trabalhando. parece não problema de pesquisa de DNS. aqui está alguns screenhort quando usar o domínio
entãoamesmapáginacomip
Para evitar a effection do cache do navegador. Eu limpei todo o cache do navegador, tentei primeiro carregar o ip e depois carregar o domínio. as maiores diferenças estão em "stalled" e "initial connection".
Eu uso o comando top
moniter a memória e o uso da cpu, os 3 servidores parecem normais quando a velocidade é lenta.
s1
top - 18:21:57 up 21:44, 1 user, load average: 1.08, 1.28, 1.10
Tasks: 108 total, 2 running, 106 sleeping, 0 stopped, 0 zombie
Cpu(s): 7.3%us, 2.4%sy, 0.0%ni, 77.8%id, 12.2%wa, 0.0%hi, 0.0%si, 0.2%st
Mem: 1922200k total, 1847432k used, 74768k free, 2224k buffers
Swap: 1048572k total, 81224k used, 967348k free, 84816k cached
s2
top - 18:31:24 up 21:55, 1 user, load average: 0.15, 0.09, 0.02
Tasks: 119 total, 1 running, 118 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0%us, 1.0%sy, 0.0%ni, 95.8%id, 0.0%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 1922200k total, 1669328k used, 252872k free, 25652k buffers
Swap: 1048572k total, 69256k used, 979316k free, 458528k cached
s3
top - 18:21:21 up 1 day, 5:57, 1 user, load average: 1.03, 0.88, 0.90
Tasks: 105 total, 2 running, 103 sleeping, 0 stopped, 0 zombie
Cpu(s): 25.7%us, 20.0%sy, 0.0%ni, 53.9%id, 0.0%wa, 0.0%hi, 0.2%si, 0.2%st
Mem: 1922200k total, 1758088k used, 164112k free, 58712k buffers
Swap: 1048572k total, 128k used, 1048444k free, 226396k cached
por favor, olhe a média de carga. 2 servidores estão acima do valor 1.
De fato, no DNS, eu configurei o servidor 1 primeiro. Uma posição de endereço, mas por que o servidor 2 se tornou o servidor principal?