Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centos 6.5 运行后出现Name or service not known错误。 #60

Open
sky8neil opened this issue Sep 22, 2016 · 19 comments
Open

Centos 6.5 运行后出现Name or service not known错误。 #60

sky8neil opened this issue Sep 22, 2016 · 19 comments

Comments

@sky8neil
Copy link

sky8neil commented Sep 22, 2016

运行环境:Centos6.5+lnmp. 上面已经运行wordpress博客。
之前已经配置过shadowsocks-libev,配置了supervisord,配置文件在/etc/shadow/*.json(可以正常运行)
我目前已经把supervisord通过pip 删除。但配置文件还没删。

这台VPS配了两个IP。一个运行代理,一个运行网页。

我的config.py:

Config

MYSQL_HOST = '#代理IP#'
MYSQL_PORT = 3306
MYSQL_USER = 'user'
MYSQL_PASS = 'aabbc'
MYSQL_DB = 'ssdb'

ss-panel .env配置:

db_driver = 'mysql'
db_host = '#代理IP#'
db_port = '3306'
db_database = 'ssdb'
db_username = 'user'
db_password = 'aabbc'
db_charset = 'utf8'
db_collation = 'utf8_general_ci'
db_prefix = ''

python 是2.7版本。

运行python servers.py 出现:

Traceback (most recent call last):
File "/home/shadowsocks-rm/shadowsocks/dbtransfer.py", line 207, in thread_push
DbTransfer.get_instance().push_db_all_user()
File "/home/shadowsocks-rm/shadowsocks/dbtransfer.py", line 119, in push_db_all_user
response = urllib2.urlopen(req)
File "/usr/local/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/local/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/local/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/local/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.7/urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/local/lib/python2.7/urllib2.py", line 1177, in do_open
raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>

请问需要如何解决?

@zuoruizhi
Copy link

SS-panel版本多少,V2的吧config.py 中PANEL_VERSION 改了
config.py配置文件上全

@sky8neil
Copy link
Author

ss-panel 是v3的。
以下是config.py完整配置

import logging

#Config
MYSQL_HOST = ''#代理IP#'
MYSQL_PORT = 3306
MYSQL_USER = 'ssuser'
MYSQL_PASS = 'aabbc'
MYSQL_DB = 'ssdb'

MANAGE_PASS = 'passwd'
#if you want manage in other server you should set this value to global ip
MANAGE_BIND_IP = '127.0.0.1'
#make sure this port is idle
MANAGE_PORT = 23333

PANEL_VERSION = 'V3' # V2 or V3. V2 not support API
API_URL = 'http://domain/mu'
API_PASS = 'mupass'
NODE_ID = '1'
CHECKTIME = 15
SYNCTIME = 600

#BIND IP
#if you want bind ipv4 and ipv6 '[::]'
#if you want bind all of ipv4 if '0.0.0.0'
#if you want bind all of if only '4.4.4.4'
SS_BIND_IP = '0.0.0.0'
SS_METHOD = 'md5'

#LOG CONFIG
LOG_ENABLE = True
LOG_LEVEL = logging.DEBUG
LOG_FILE = '/var/log/shadowsocks.log'

@zuoruizhi
Copy link

PANEL_VERSION = 'V3' # V2 or V3. V2 not support API
API_URL = 'http://domain/mu'
API_PASS = 'mupass'
NODE_ID = '1'

把配置文件配置全
这一段明显是默认的

@sky8neil
Copy link
Author

请问这一段如何配置,我在wiki里是空的,我找了几个教程都没说配置这里
https://iforday.com/160.html
https://prinzeugen.net/build-shadowsocks-sharing-site-with-ss-panel/
这是我找的两个配置教程。

@zuoruizhi
Copy link

代码更新了教程没更新
API_PASS 和前端的muKey写一样的
API_URL = 'http://你的域名/mu'
NODE_ID写数据库里这个节点的ID

@sky8neil
Copy link
Author

多谢,已经可以了!

@sky8neil
Copy link
Author

再问一下,我现在可以使用ss,网页端和命令行都正常显示,但ss-panel不统计流量是什么问题?

@zuoruizhi
Copy link

Synctime控制,同步间隔600秒,你再等一会

@sky8neil
Copy link
Author

十分感谢!

@ILoveMoneyAndGirl
Copy link

@zuoruizhi @neilxu1 API_PASS 和前端的muKey写一样的
API_URL = 'http://你的域名/mu'
NODE_ID写数据库里这个节点的ID 中的muKey 前端怎么设置?

@zuoruizhi
Copy link

前端配置文件

@ILoveMoneyAndGirl
Copy link

谢谢,回答这么及时。

@ILoveMoneyAndGirl
Copy link

//////////////////////////////////// config.py///////////////////////////////
import logging

#Config
MYSQL_HOST = '127.0.0.1'
MYSQL_PORT = 3306
MYSQL_USER = 'sspanel'
MYSQL_PASS = 'sspanel'
MYSQL_DB = 'sspanel'

MANAGE_PASS = 'passwd'
#if you want manage in other server you should set this value to global ip
MANAGE_BIND_IP = '127.0.0.1'
#make sure this port is idle
MANAGE_PORT = 23333

PANEL_VERSION = 'V3' # V2 or V3. V2 not support API
API_URL = 'http://www.ss2vpn.com/mu'
API_PASS = 'sspanel'
NODE_ID = '1'
CHECKTIME = 15
SYNCTIME = 600

#BIND IP
#if you want bind ipv4 and ipv6 '[::]'
#if you want bind all of ipv4 if '0.0.0.0'
#if you want bind all of if only '4.4.4.4'
SS_BIND_IP = '0.0.0.0'
SS_METHOD = 'rc4-md5'

#LOG CONFIG
LOG_ENABLE = False
LOG_LEVEL = logging.DEBUG
LOG_FILE = '/var/log/shadowsocks.log'
////////////////////////////////////// ss-panel//////////////////////
// ss-panel v3 配置
//
// !!! 修改此key为随机字符串确保网站安全 !!!
key = 'ss2vpn'
env = 'prod' // 正式环境请保持env为prod确保安全
debug = 'false' // 正式环境请确保为false
appName = 'ss-panel3' //站点名称
baseUrl = 'https://www.ss2vpn.com' // 站点地址
timeZone = 'PRC' // RPC 天朝时间 UTC 格林时间
pwdMethod = 'md5' // 密码加密 可选 md5,sha256
salt = '' // 密码加密用,从旧版升级请留空
theme = 'default' // 主题
// v3.4 后使用 session代替authDriver
// session,cache 可选 file/redis
session = 'file'
cache = 'file'
tokenDriver = 'db'
// mu key 用于校验ss-go mu的请求
muKey = 'sspanel'
// 邮件
mailDriver = 'mailgun' // mailgun #smtp不在支持,仅供测试

// 注册限制,每天每个ip能注册的次数
ipDayLimit = '10'

// 邮箱验证设置
emailVerifyEnabled = 'false' // 是否开启注册时邮箱验证 (true:开启 false:关闭)
emailVerifyCodeLength = '8' // 邮箱验证代码长度
emailVerifyTTL = '30' // 验证代码有效时间 单位分钟

// 用户签到设置
checkinTime = '22' // 签到间隔时间 单位小时
checkinMin = '93' // 签到最少流量 单位MB
checkinMax = '97' // 签到最多流量

//
defaultTraffic = '1' // 用户初始流量 单位GB
// 注册后获得的邀请码数量
inviteNum = '1'

// 记录流量日志到dynamodb ,beta,请勿开启
log_traffic_dynamodb = 'false'

database 数据库配置

db_driver = 'mysql'
db_host = 'localhost'
db_port = '3306'
db_database = 'sspanel'
db_username = 'sspanel'
db_password = 'sspanel'
db_charset = 'utf8'
db_collation = 'utf8_general_ci'
db_prefix = ''

redis

////////////////已上是我的配置文件
运行 python servers.py 直接 没输出,卡死。找了很久不知道原因,麻烦大神帮忙看看 @zuoruizhi

@zuoruizhi
Copy link

运行姿势不对 python servers.py &
要放在后台运行 正常运行程序时啥输出都没有的,都输出到日志了

@zuoruizhi
Copy link

而且你日志没开 config.py LOG_ENABLE = True

@ILoveMoneyAndGirl
Copy link

这样是不是成功了?
//运行了python servers.py &
输出:[1] 4377
以下是日志/var/log/shadowsocks.log :
2016, Sep 23 Fri 21:28:38 eventloop.py[line:251] DEBUG using event model: epoll
2016, Sep 23 Fri 21:28:39 dbtransfer.py[line:187] INFO db loop
2016, Sep 23 Fri 21:28:39 dbtransfer.py[line:176] INFO db start server at port [1025] pass [2Fec62]
2016, Sep 23 Fri 21:28:39 manager.py[line:86] INFO adding server at 0.0.0.0:1025
2016, Sep 23 Fri 21:28:39 dbtransfer.py[line:176] INFO db start server at port [1026] pass [ngtod7]
2016, Sep 23 Fri 21:28:39 manager.py[line:86] INFO adding server at 0.0.0.0:1026
2016, Sep 23 Fri 21:28:40 dbtransfer.py[line:176] INFO db start server at port [1027] pass [u6BSwN]
2016, Sep 23 Fri 21:28:40 manager.py[line:86] INFO adding server at 0.0.0.0:1027
2016, Sep 23 Fri 21:28:40 dbtransfer.py[line:205] INFO db loop2
2016, Sep 23 Fri 21:28:40 dbtransfer.py[line:121] INFO http://www.ss2vpn.com/mu/nodes/1/online_count?key=sspanel - count=0 - {"ret":1,"msg":"ok"}
2016, Sep 23 Fri 21:28:40 dbtransfer.py[line:138] INFO http://www.ss2vpn.com/mu/nodes/1/info?key=wayz10xs.c.c - load=0.00+0.00+0.00+3%2F173+4380&uptime=14032.02 - {"ret":1,"msg":"ok"}
2016, Sep 23 Fri 21:28:55 dbtransfer.py[line:187] INFO db loop
2016, Sep 23 Fri 21:29:10 dbtransfer.py[line:187] INFO db loop
~
~

@zuoruizhi
Copy link

对 不过建议你吧所有的key password 都改一下吧 全发出来了

@ILoveMoneyAndGirl
Copy link

ok.谢谢 @zuoruizhi

@xiaobailong24
Copy link

Thank all of you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants