软件类型 | 软件版本 |
---|---|
操作系统 | Ubuntu 22.04.3 LTS |
IDE | PyCharm 2023.3.2 (Professional Edition) |
灵码版本 | 1.0.10 |
图形化界面使用自动代理
命令行使用http代理
pycharm使用自动代理
公司网络不能直接连接外网,需要使用代理,但是配置代理后虽然可以登录,但是显示无权限:
启动命令:
/home/qianyk/.lingma/bin/1.0.17/x86_64_linux/Lingma start
http_proxy=http://proxy.neusoft.com:8080;https_proxy=http://proxy.neusoft.com:8080;/home/qianyk/.lingma/bin/1.0.17/x86_64_linux/Lingma start
日志已经显示识别到了代理,但连接仍然失败
2023-12-28T09:21:15.368+0800 INFO ===== Starting lingma service =====
2023-12-28T09:21:15.369+0800 INFO Init local db success.
2023-12-28T09:21:15.369+0800 INFO start chat sessions clear timer.
2023-12-28T09:21:15.369+0800 INFO Lingma 1.0.17 running on linux(amd64) at /home/qianyk/.lingma
2023-12-28T09:21:15.369+0800 INFO Detect system proxy: http://proxy.neusoft.com:8080
2023-12-28T09:21:15.369+0800 INFO Use system proxy. url: http://proxy.neusoft.com:8080
2023-12-28T09:21:15.369+0800 INFO Info lock obtained
2023-12-28T09:21:15.369+0800 INFO Checking update ...
2023-12-28T09:21:15.369+0800 INFO Preparing inference environment
2023-12-28T09:21:15.369+0800 INFO Inference environment is ready
2023-12-28T09:21:15.369+0800 INFO Starting local java inference service
2023-12-28T09:21:15.369+0800 WARN Cannot start default local service: path error: model file doesn't exist at: /home/qianyk/.lingma/model/0.1.0/java.model
2023-12-28T09:21:15.369+0800 INFO Skip update model, current version: 0.1.0
2023-12-28T09:21:15.369+0800 INFO Succeed to update Cosy model
2023-12-28T09:21:15.493+0800 INFO Succeed to create inference environment
2023-12-28T09:21:15.494+0800 INFO Succeed to update inference env
2023-12-28T09:21:25.396+0800 WARN Failed to parse heartbeat response
2023-12-28T09:21:25.396+0800 INFO Server is ready at: 36510 / 37510
2023-12-28T09:21:28.736+0800 INFO Client 0xc00018c110 is registered
2023-12-28T09:21:28.740+0800 INFO initializing client: 0xc00018c110
2023-12-28T09:21:28.740+0800 INFO Registering IntelliJ IDEA 2023.3.2
2023-12-28T09:21:28.740+0800 INFO Server initialized, time cost: 140.42µs
2023-12-28T09:21:28.740+0800 INFO skip gitignore file: .gitignore doesn't exist
2023-12-28T09:21:28.740+0800 INFO start to index files in workspace: /ntfs1/code-qyk/server-script
2023-12-28T09:21:29.024+0800 INFO index python count:100 nochange:0 walk cost:279
2023-12-28T09:21:29.026+0800 INFO index misc meta count:2 walk cost:0
2023-12-28T09:21:29.026+0800 INFO indexer walk files count:50 ignore:4 walk cost:286
2023-12-28T09:21:35.327+0800 INFO Logging via web
2023-12-28T09:21:35.327+0800 INFO Opening browser to login
2023-12-28T09:21:38.745+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": dial tcp 101.200.166.242:443: i/o timeout (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:45.859+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:45.862+0800 INFO Broadcast 1 clients, 1 success
2023-12-28T09:21:45.862+0800 INFO GET 200 /auth/callback?state=98894121b55448dda16858891b0998b2&auth=uOJf%23%2Cnsc*%29_V%40%23%5EGOjbup%24%24V%5ENIVM%26kjRp%5El%40TYj%5E%26%5EoOC%29V%40VklRBIj%5EpwV%5Ez%25VMNIVfn%25 use time 10.007281176s content-length 1736
2023-12-28T09:21:45.923+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/index.css use time 289.479µs content-length 30585
2023-12-28T09:21:45.925+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/index.js use time 1.883694ms content-length 204069
2023-12-28T09:21:45.926+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/public/code/lib/7.8.3_polyfill.min.js,16.13.1_react.production.min.js,16.13.1_react-dom.production.min.js,4.0.1_redux.min.js,7.2.4_react-redux.min.js,2.3.0_redux-thunk.min.js,2.29.1_moment.min.js,2.29.1_zh-cn.js,0.21.2axios.min.js use time 2.330587ms content-length 334682
2023-12-28T09:21:45.926+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/public/yunxiao-fe/teamix-ui/1.5.27/style/style/yunxiao-v5.min.css use time 4.212442ms content-length 1276537
2023-12-28T09:21:45.927+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/public/yunxiao-fe/teamix-ui/1.5.27/dist/dist/teamix-ui.min.js use time 3.631963ms content-length 1651778
2023-12-28T09:21:46.674+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/downloads/imgextra/i3/O1CN01njVfgg1RAZ82tNnnA!!6000000002071-55-tps-405-400.svg use time 42.714µs content-length 4515
2023-12-28T09:21:46.686+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/downloads/t/a/font_2460530_m828xxmy33a.js use time 438.96µs content-length 351231
2023-12-28T09:21:46.686+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/downloads/t/a/font_2460517_9rqa0cua6h.js use time 500.004µs content-length 155500
2023-12-28T09:21:55.331+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:55.871+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:56.832+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:57.372+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": dial tcp 101.200.166.242:443: i/o timeout (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:58.396+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:59.898+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
启动命令:
http_proxy=http://proxy.neusoft.com:8080;https_proxy=http://proxy.neusoft.com:8080;pycharm1
以上方法均没有效果
请问我要如何解决?
用iptables做端口转发转发:
iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 101.200.166.242:443
iptables -t nat -A POSTROUTING -p tcp -d 101.200.166.242 --dport 443 -j SNAT --to-source 192.168.5.59
101.200.166.242
是lingma-api.tongyi.aliyun.com
解析出来的IP,也就是日志里边连不上的域名。192.168.5.59
是能连接外网的服务器地址。
加上如下一行:
192.168.5.59 lingma-api.tongyi.aliyun.com
最后重新启动灵码进程就能用了。
前提1:你们公司的代理不太严,支持http隧道
前提2:你的电脑上不会有443端口监听
前提3:你有你电脑的root权限
使用ncat软件
#!/bin/bash
sudo ncat --sh-exec "ncat --proxy proxy.neusoft.com:8080 --proxy-type http lingma-api.tongyi.aliyun.com 443" -l 443 --keep-open >> lingma-ncat.log 2>&1 &
加上如下一行:
127.0.0.1 lingma-api.tongyi.aliyun.com
最后重新启动灵码进程就能用了。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。