简体   繁体   English

无法通过互联网连接到tryton(postgresql)

[英]Cannot connect to tryton (postgresql) via internet

I have a working local installation of tryton. 我有一个工作的本地安装的tryton。 But connecting from a remote client doesn't work. 但是从远程客户端连接不起作用。 tryton is build opon Postgre SQL, from documentation I assume the nature of the problem lies there. tryton是构建opon Postgre SQL,从文档我假设问题的本质就在那里。


Edit: It turned out the problem was neither PostgreSQL nor the trytond.conf script alone, but rather that I needed to add an endpoint in the setup of the Virtual Machine on Windows Azure for Port 8000. See http://xmodulo.com/2012/12/how-to-open-ports-on-windows-azure-vm.html . 编辑:事实证明问题既不是PostgreSQL也不是trytond.conf脚本,而是我需要在Windows Azure上为端口8000安装虚拟机的端点。请参阅http://xmodulo.com/ 2012/12 / how-to-open-ports-on-windows-azure-vm.html However, the answer below regarding the trytond.conf file is correct as well. 但是,下面关于trytond.conf文件的答案也是正确的。


In /etc/trytond.conf I've entered the IP address of the tryton server: 在/etc/trytond.conf中我输入了tryton服务器的IP地址:

#This file is part of Tryton.  The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
[options]

# This is the hostname used when generating tryton URI
#hostname = 

# Activate the json-rpc protocol
jsonrpc = 23.97.165.118:8000
#ssl_jsonrpc = False

(This is an example IP) (这是一个IP示例)

Running the checks from the FAQ: trytond is running correctly: 运行FAQ中的检查:trytond正常运行: 在此输入图像描述

Listening ports: 听力端口: 在此输入图像描述

However, no connect from the client via internet. 但是,没有通过互联网从客户端连接。

I'd like every client from anywhere on the internet to be able to connect (not best for security, but user's IPs change, so no way to avoid this). 我希望互联网上任何地方的每个客户都能够连接(不是最好的安全性,但用户的IP改变,所以没办法避免这种情况)。

What do I have to enter into /etc/postgresql/9.1/main/pg_hba.conf? 我有什么要进入/etc/postgresql/9.1/main/pg_hba.conf?

And what needs to go into postgresql.conf? 什么需要进入postgresql.conf? And in which one? 在哪一个? Searching with "whereis postgresql.conf" finds several versions: 使用“whereis postgresql.conf”搜索找到几个版本:

root@Tryton:~# whereis postgresql.conf
postgresql: /etc/postgresql /usr/lib/postgresql /usr/share/postgresql

Thank you very much for your help in advance. 非常感谢您的帮助。

Edit: Here are the configuration files. 编辑:这是配置文件。 Runs ok locally on server, but cannot connect tryton client via internet. 在服务器上本地运行,但无法通过互联网连接tryton客户端。

Config Files (changes) 配置文件(更改)

trytond.conf trytond.conf

#This file is part of Tryton.  The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
[options]

# This is the hostname used when generating tryton URI
#hostname = 

# Activate the json-rpc protocol
jsonrpc = *:8000
#ssl_jsonrpc = False

# Configure the path of json-rpc data
#jsondata_path = /var/www/localhost/tryton

# Activate the xml-rpc protocol
#xmlrpc = *:8069
#ssl_xmlrpc = False

# Activate the webdav protocol
#webdav = *:8080
#ssl_webdav = False

# Configure the database type
# allowed values are postgresql, sqlite, mysql
#db_type = postgresql

# Configure the database connection
## Note: Only databases owned by db_user will be displayed in the connection dialog
## of the Tryton client. db_user must have create permission for new databases
## to be able to use automatic database creation with the Tryton client.
#db_host = False
#db_port = False
db_user = tryton
db_password = tryton_password
#db_minconn = 1
#db_maxconn = 64

# Configure the postgresql path for the executable
#pg_path = None

# Configure the Tryton server password
#admin_passwd = admin

pg_hba.conf 的pg_hba.conf

# PostgreSQL Client Authentication Configuration File
# ===================================================


# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local   all             postgres                                md5

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
# Original:
#host    all             all             127.0.0.1/32            md5
# Neu:
# Option 1: host     all          all      0.0.0.0/0       md5
host     all          all      127.0.0.1/32       md5



# IPv6 local connections:
# Original:
#host    all             all             ::1/128                 md5
# Neu:
host     all          all      ::/0            md5

# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5

postgresql.conf postgresql.conf中

# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#


#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
                    # comma-separated list of addresses;
                    # defaults to 'localhost', '*' = all
                    # (change requires restart)



port = 5432             # (change requires restart)
max_connections = 100           # (change requires restart)

There is no issue related to postgresql as the postgresql connection is done from the server, so the problem is the config file, and exactly the jsonrpc option. 没有与postgresql相关的问题,因为postgresql连接是从服务器完成的,所以问题是配置文件,以及jsonrpc选项。

Basically this setting is for saying on which local interface/ip will tryton listen for conections: 基本上这个设置用于说明哪个本地接口/ ip将tryton监听连接:

So if you use: 所以如果你使用:

jsonrpc = 23.97.165.118:8000 jsonrpc = 23.97.165.118:8000

The server will listen on 23.97.165.118 and will only accept connections with destination 23.97.165.118, so you won't be able to access it throw localhost as localhost maps to 127.0.0.1 服务器将侦听23.97.165.118,并且只接受目标为23.97.165.118的连接,因此当localhost映射到127.0.0.1时,您将无法访问它。

Having said that I will recomend using the following setting: 话虽如此,我会建议使用以下设置:

jsonrpc = *:8000 jsonrpc = *:8000

Which will listen to all the interfaces of the server (localhost and any external connections that you have). 它将侦听服务器的所有接口(localhost和您拥有的任何外部连接)。

Note: You must restart your tryton server in order to apply the changes in the configuration file. 注意:必须重新启动tryton服务器才能在配置文件中应用更改。

I had the same issue, and advice in the accepted answer was actually the cause of my troubles. 我有同样的问题,接受的答案中的建议实际上是我的麻烦的原因。 The correct syntax (at least for recent versions, 3.4 to 3.8) is the following : 正确的语法 (至少对于最新版本,3.4到3.8)如下:

[jsonrpc]
listen = *:8000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM