nginx 1.9 + tomcat8 + nfs 配置集群环境
来源:互联网 发布:php 打印log日志 编辑:程序博客网 时间:2024/05/15 20:13
启动tomcat8,访问地址为:
192.168.1.207:8080
192.168.1.208:8080
nginx:#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo#yum makecache#wget http://nginx.org/download/nginx-1.9.12.tar.gz#tar zxvf nginx-1.9.12.tar.gz #cd nginx-1.9.12/#./configure #yum -y install gcc #安装c 编译环境#./configure --prefix=/usr/local/nginx #yum -y install pcre-devel openssl openssl-devel #安装错误: ./configure: error: the HTTP rewrite module requires the PCRE library.#./configure --prefix=/usr/local/nginx#make && make install#cd /usr/local/nginx/sbin/#./nginx#netstat -tunlpa
lsof -p 进程PID #查看进程在调用哪些文件[root@pptp-redis opt]# ll总用量 160156drwxr-xr-x 9 root root 4096 7月 22 13:47 apache-tomcat-8.0.24-rw-r--r-- 1 root root 9106353 7月 22 13:23 apache-tomcat-8.0.24.tar.gz-rw-r--r-- 1 root root 153512879 7月 22 13:23 jdk-7u79-linux-x64.tar.gzdrwxrwxr-x 6 root root 4096 7月 14 15:42 redis-3.0.2-rw-r--r-- 1 root root 1360182 7月 14 15:10 redis-3.0.2.tar.gzdrwxr-xr-x. 2 root root 4096 11月 22 2013 rh[root@pptp-redis opt]# tar zxf apache-tomcat-8.0.24.tar.gz [root@pptp-redis opt]# cd apache-tomcat-8.0.24[root@pptp-redis apache-tomcat-8.0.24]# ./bin/startup.sh Using CATALINA_BASE: /opt/apache-tomcat-8.0.24Using CATALINA_HOME: /opt/apache-tomcat-8.0.24Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.24/tempUsing JRE_HOME: /usrUsing CLASSPATH: /opt/apache-tomcat-8.0.24/bin/bootstrap.jar:/opt/apache-tomcat-8.0.24/bin/tomcat-juli.jarTomcat started.[root@pptp-redis apache-tomcat-8.0.24]#
#user nobody;worker_processes auto;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 10240;}http { include mime.types; default_type application/octet-stream; #access_log logs/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; upstream sports_server { server 172.16.1.200:8080 weight=3; server 172.16.1.204:8080 weight=3; } server { listen 80; server_name 172.16.1.203; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm index.php; proxy_pass http://sports_server; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; include fastcgi_params; } #location ~ /\.ht { # deny all; #} location /nginx_stat { stub_status on; # Turn on nginx stats access_log off; # We do not need logs for stats allow 127.0.0.1; # Security: Only allow access from IP allow 172.16.1.195; allow 172.16.1.188; deny all; # Deny requests from the other of the world } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #}}
nfs:centos 6.6 预装好了
服务端:
[root@203-test shared]# vim /etc/exports
/opt/shared 172.16.1.0/24(rw,sync,no_root_squash)
/opt/shared 172.16.1.0/24(rw,sync,no_root_squash)
说明:/opt/shared 为共享的目录位置; *(rw,no_root_squash) *为任意IP都可以访问 rw为可进行读写访问 no_root_squash 为拥有这个目录所有者的权限。
[root@203-test shared]# service nfs restart
客户端:
mount -t nfs -o rw 192.168.109.130:/opt/shared /opt/shared 命令完成挂载(远端/opt/shared 挂载到本地/opt/shared)
要想每次启动机器的时候自动挂载,可使用命令 vi /etc/fstab 编辑,在最后面加上 192.168.109.130:/var/ftp /nfs/ftp nfs defaults 0 0 ,保存退出。这样在每次启动的时候就会自动挂载 192.168.109.130:/var/ftp 这个NFS 共享了。
用 mount 方式挂载 NFS 并不是个很可靠的方式,当遇到断网或挂载时 NFS 服务器重启,都会导致客户端上的 NFS 无法访问的问题。但这也是能解决的,使用 autofs 服务的方式挂载就不会有这个问题了。回头找时间把这个经验也分享出来。
<span style="font-size:10px;">#umount /data1/logs/web1logsumount.nfs: /data1/logs/web1logs: device is busyumount.nfs: /data1/logs/web1logs: device is busy</span>方法一:
fuser -m -v /data/
用户 进程号 权限 命令
/data/: root 2798 ..c.. bash
root 2996 ..c.. su
如上所示,有两个进程占用了,将其kill掉,再重新取消挂载。
kill -9 2798 2996
umount /data1/logs/web1logs
方法二:
umount -l /data1/logs/web1logs
方法三:
fuser -km /data1/logs/web1logs
0 0
- nginx 1.9 + tomcat8 + nfs 配置集群环境
- linux Nginx配置篇:tomcat8+nginx+memcache集群session共享
- Tomcat8 集群配置(Ubuntu)
- Tomcat8.5集群配置
- Tomcat8环境配置
- ubuntu配置Tomcat8环境
- 生产环境下hadoop集群配置之NFS配置实验
- tomcat8+nginx 超简单配置
- Tomcat8.5.14+Redis+Nginx实现集群
- nginx + tomcat7 配置集群环境 Windows
- window环境Nginx+Tomcat集群配置
- Ubuntu14.04下,Tomcat8+Nginx+memcache配置服务器集群session共享
- tomcat8安装配置及nginx反向代理
- NginX+Tomcat8的负载均衡配置
- NFS环境安装配置
- Nginx 集群环境搭建
- Nginx集群环境搭建
- Nginx+tomcat8
- 智能指针总结及应用(一)
- android官方技术文档翻译——设计时布局属性
- linux c find grep awk
- Windows下安装Django
- js中下载弹窗链接
- nginx 1.9 + tomcat8 + nfs 配置集群环境
- 几种线程池的实现算法分析
- hdu5288 多校
- SecureCRT 常用命令大全
- hdu 5294 Tricks Device
- Xshell连接Linux服务器总掉线
- Zookeeper Introduce Zookeeper原理介绍
- Android 自定义雷达图
- 【数据结构与算法分析1.2】编写一个程序求解字谜游戏问题