首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法通过互联网连接tryton (postgresql)

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

Stack Overflow用户
提问于 2014-02-27 09:43:08
回答 2查看 2.3K关注 0票数 0

我在当地安装了tryton。但是从远程客户端连接不起作用。tryton是构建opon Postgre SQL的,从文档中我假设问题的本质就在这里。

编辑:原来问题既不是PostgreSQL,也不是trytond.conf脚本,而是我需要在WindowsAzureforPort8000的虚拟机设置中添加一个端点。见http://xmodulo.com/2012/12/how-to-open-ports-on-windows-azure-vm.html。但是,下面有关trytond.conf文件的答案也是正确的。

在/etc/trtond.conf中,输入了tryton服务器的IP地址:

代码语言:javascript
复制
#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

(这是一个IP示例)

从FAQ: trytond运行的检查是否正确:

监听端口:

但是,不能通过互联网从客户端连接。

我希望来自互联网任何地方的每一个客户都能够连接(这不是最好的安全性,但用户的I改变,所以没有办法避免这种情况)。

我必须输入什么/etc/postgresql/9.1/main/pg_hba.conf?

postgresql.conf需要做些什么呢?在哪一个?使用"whereis postgresql.conf“搜索可以找到几个版本:

代码语言:javascript
复制
root@Tryton:~# whereis postgresql.conf
postgresql: /etc/postgresql /usr/lib/postgresql /usr/share/postgresql

非常感谢您的提前帮助。

编辑:这是配置文件。在服务器上本地运行正常,但不能通过internet连接tryton客户端。

配置文件(更改)

trytond.conf

代码语言:javascript
复制
#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

代码语言:javascript
复制
# 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

代码语言:javascript
复制
# -----------------------------
# 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)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-02-27 16:27:53

没有与postgresql相关的问题,因为postgresql连接是从服务器完成的,因此问题在于配置文件,以及确切地说是jsonrpc选项。

基本上,这个设置是用来表示tryton将监听哪个本地接口/ip:

所以如果你用:

jsonrpc = 23.97.165.118:8000

服务器将监听23.97.165.118,并且只接受与目的地23.97.165.118的连接,因此无法访问它,因此无法将localhost作为localhost映射到127.0.0.1。

话虽如此,我还是将使用以下设置进行介绍:

jsonrpc = *:8000

它将侦听服务器的所有接口(本地主机和您拥有的任何外部连接)。

注意:为了应用配置文件中的更改,您必须重新启动tryton服务器。

票数 1
EN

Stack Overflow用户

发布于 2016-02-14 18:10:43

我也有过同样的问题,而被接受的答案中的建议实际上是我烦恼的原因。正确语法 (至少对于最近的版本,3.4-3.8)如下:

代码语言:javascript
复制
[jsonrpc]
listen = *:8000
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22064595

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档