簡體   English   中英

無法通過互聯網連接到tryton(postgresql)

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

我有一個工作的本地安裝的tryton。 但是從遠程客戶端連接不起作用。 tryton是構建opon Postgre SQL,從文檔我假設問題的本質就在那里。


編輯:事實證明問題既不是PostgreSQL也不是trytond.conf腳本,而是我需要在Windows Azure上為端口8000安裝虛擬機的端點。請參閱http://xmodulo.com/ 2012/12 / how-to-open-ports-on-windows-azure-vm.html 但是,下面關於trytond.conf文件的答案也是正確的。


在/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

(這是一個IP示例)

運行FAQ中的檢查:trytond正常運行: 在此輸入圖像描述

聽力端口: 在此輸入圖像描述

但是,沒有通過互聯網從客戶端連接。

我希望互聯網上任何地方的每個客戶都能夠連接(不是最好的安全性,但用戶的IP改變,所以沒辦法避免這種情況)。

我有什么要進入/etc/postgresql/9.1/main/pg_hba.conf?

什么需要進入postgresql.conf? 在哪一個? 使用“whereis postgresql.conf”搜索找到幾個版本:

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

非常感謝您的幫助。

編輯:這是配置文件。 在服務器上本地運行,但無法通過互聯網連接tryton客戶端。

配置文件(更改)

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

# 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 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)

沒有與postgresql相關的問題,因為postgresql連接是從服務器完成的,所以問題是配置文件,以及jsonrpc選項。

基本上這個設置用於說明哪個本地接口/ ip將tryton監聽連接:

所以如果你使用:

jsonrpc = 23.97.165.118:8000

服務器將偵聽23.97.165.118,並且只接受目標為23.97.165.118的連接,因此當localhost映射到127.0.0.1時,您將無法訪問它。

話雖如此,我會建議使用以下設置:

jsonrpc = *:8000

它將偵聽服務器的所有接口(localhost和您擁有的任何外部連接)。

注意:必須重新啟動tryton服務器才能在配置文件中應用更改。

我有同樣的問題,接受的答案中的建議實際上是我的麻煩的原因。 正確的語法 (至少對於最新版本,3.4到3.8)如下:

[jsonrpc]
listen = *:8000

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM