chenfromsz / correct

15 stars 6 forks source link

7.1.5 启动Tracker Server的Nginx报错,找不到文件proxy.conf,请问这个文件什么时候生成的? #26

Open CoderDream opened 4 years ago

CoderDream commented 4 years ago

user nginx nginx; worker_processes 4; pid /usr/local/nginx/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 20480; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request"' '$status $body_bytes_sent "$http_referer"' '"$http_user_agent" "$http_x_forwarded_for" "$request_time"'; access_log /usr/local/nginx/logs/access.log main; upstream server_group1{ server 192.168.1.215; server 192.168.1.216; } server { listen 84; server_name 192.168.1.214; location /group1 { include proxy.conf; proxy_pass http://server_group1; } } }

` [root@localhost nginx-1.7.0]# systemctl status nginx.service ● nginx.service - SYSV: Nginx is a high-performance web and proxy server. Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled) Active: failed (Result: exit-code) since 三 2020-08-26 17:52:00 CST; 6s ago Docs: man:systemd-sysv-generator(8) Process: 10529 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=1/FAILURE)

8月 26 17:52:00 localhost.localdomain systemd[1]: Starting SYSV: Nginx is a high-performance web and proxy server.... 8月 26 17:52:00 localhost.localdomain nginx[10529]: /etc/rc.d/init.d/nginx: line 20: [: =: unary operator expected 8月 26 17:52:00 localhost.localdomain nginx[10529]: Starting nginx: nginx: [emerg] open() "/usr/local/nginx/conf/proxy.conf" failed (2: No such file or directory) in /usr/local/nginx/...ginx.conf:55 8月 26 17:52:00 localhost.localdomain nginx[10529]: [FAILED] 8月 26 17:52:00 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1 8月 26 17:52:00 localhost.localdomain systemd[1]: Failed to start SYSV: Nginx is a high-performance web and proxy server.. 8月 26 17:52:00 localhost.localdomain systemd[1]: Unit nginx.service entered failed state. 8月 26 17:52:00 localhost.localdomain systemd[1]: nginx.service failed. Hint: Some lines were ellipsized, use -l to show in full. `

chenfromsz commented 4 years ago

脚本文件请从这里下载: https://gitee.com/chenshaojian/SpringCloud/tree/master/proxy 码云上有新的程序,对应是新版的书籍:《Spring Cloud微服务架构实战》 https://item.jd.com/12818872.html

CoderDream commented 4 years ago

脚本文件请从这里下载: https://gitee.com/chenshaojian/SpringCloud/tree/master/proxy 码云上有新的程序,对应是新版的书籍:《Spring Cloud微服务架构实战》 https://item.jd.com/12818872.html

[oneproxy] keepalive = 1 event-threads = 4 log-file = log/oneproxy.log pid-file = log/oneproxy.pid lck-file = log/oneproxy.lck mysql-version = 5.7.19 proxy-address = :3306 proxy-master-addresses.1 = 10.10.10.35:3306@group1 proxy-master-addresses.2 = 10.10.10.25:3306@group2 proxy-slave-addresses.1 = 10.10.10.36:3306@group1 proxy-slave-addresses.2 = 10.10.10.37:3306@group1 proxy-slave-addresses.3 = 10.10.10.26:3306@group2 proxy-slave-addresses.4 = 10.10.10.27:3306@group2 proxy-user-list.1 = orderuser/40739ED24B5DC118DC16397AB14E64C680637C0D@orderdb proxy-user-list.2 = merchantuser/40739ED24B5DC118DC16397AB14E64C680637C0D@merchantdb proxy-part-tables.1 = /usr/local/oneproxy/conf/part1.txt proxy-charset = utf8_bin proxy-group-policy.1 = group1:read_balance proxy-group-policy.2 = group2:read_balance proxy-group-security.1 = group1:0 proxy-group-security.2 = group2:0 proxy-security-level = 0 proxy-sequence.1 = default

监控端口

proxy-httpserver = :8080

自动剔除节点

proxy-replication-check = 1 proxy-httptitle = OneProxy Monitor

这个文件完全与《深入实践Spring Boot》的7.1.5对应不起来。

请帮忙提供一个可以让书里面的Tracker Server Nginx运行起来的proxy.conf,多谢!

chenfromsz commented 4 years ago

《深入实践Spring Boot》中的Tracker server的ng配置,可以使用项目spring-boot-files中doc的安装包,参照书中142页的安装Nginx说明,nginx.conf是安装时是生成的,参照说明修改合适的IP地址,即可运行。 读者所指的oneproxy是另一个数据库中间件,跟上面的Tracker server所指的是一个文件系统,两者不相关。

CoderDream commented 4 years ago

我说的是“proxy.conf”文件,不是nginx.conf: 报错信息:"/usr/local/nginx/conf/proxy.conf" failed (2: No such file or directory) in /usr/local/nginx/...ginx.conf:55

IP地址没有问题: location /group1 { include proxy.conf; proxy_pass http://server_group1; } 你这里配置了include,但是相关文件(proxy.conf)找不到,书里面也没有说明。

chenfromsz commented 4 years ago

把这行注掉或者删除就行:

include proxy.conf;

chenfromsz commented 4 years ago

https://gitee.com/chenshaojian/SpringCloud/blob/master/fdfs/nginx.conf-trackerserver