chef-solo + postgres приводят к неверному pg_hba.conf

Я пытаюсь настроить postgres с соло бродяги + шеф-повара.

Я использую официальную квитанцию: http://community.opscode.com/cookbooks/postgresql.

Поскольку мой Berksfile содержит:

site :opscode

cookbook "postgresql"

И мой Vagrantfile кусок:

config.berkshelf.enabled = true

config.vm.provision "chef_solo" do |chef|

chef.add_recipe "postgresql::server"

  chef.json = {

  "postgresql" => {
      "version" => "9.2",
      "password" => { "postgres" => "123" },
      config: { 
      "ssl" => "false" 
  },
      pg_hba: [  
          { type: 'local', db: 'all', user: 'all', addr: '', method: 'trust' },
          { type: 'local', db: 'all', user: 'all', addr: '127.0.0.1/32', method: 'trust' },
          { type: 'local', db: 'all', user: 'all', addr: '::1/128 ', method: 'trust' } 
  ]
  }
end

Сгенерированное содержимое: /etc/postgresql/9.2/main/pg_hba.conf выглядит так:

# This file was automatically generated and dropped off by Chef!

# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file.

# TYPE  DATABASE        USER            ADDRESS                 METHOD

###########
# Other authentication configurations taken from chef node defaults:
###########

local   all             all                                     trust

local   all             all             127.0.0.1/32            trust

local   all             all             ::1/128                 trust

# "local" is for Unix domain socket connections only
local   all             all                                     peer

Однако, если я запускаю sudo service postgresql restart, происходит сбой с ошибкой:

The PostgreSQL server failed to start. Please check the log output:
2013-11-10 08:12:05 GMT LOG:  invalid authentication method "127.0.0.1/32"
2013-11-10 08:12:05 GMT CONTEXT:  line 17 of configuration file "/etc/postgresql/9.2/main/pg_hba.conf"
2013-11-10 08:12:05 GMT LOG:  invalid authentication method "::1/128"
2013-11-10 08:12:05 GMT CONTEXT:  line 19 of configuration file "/etc/postgresql/9.2/main/pg_hba.conf"
2013-11-10 08:12:05 GMT FATAL:  could not load pg_hba.conf

Проблемные записи — это те, которые содержат адрес. Есть идеи, что не так в моем случае использования?


person Peter Butkovic    schedule 10.11.2013    source источник
comment
Я не совсем уверен, но я не думаю, что вы можете оставить адрес пустым, как в первой строке. Попробуйте удалить эту строку.   -  person a_horse_with_no_name    schedule 10.11.2013
comment
Первая строка в порядке, на самом деле это единственная строка в порядке. Те, которые упоминают адрес, должны быть хостом, а не локальным. И последний в настоящее время бесполезен.   -  person Milen A. Radev    schedule 10.11.2013
comment
@MilenA.Radev спасибо за хит, это сделало это. не стесняйтесь добавлять его в качестве ответа, я буду рад отметить его как правильный.   -  person Peter Butkovic    schedule 10.11.2013


Ответы (1)


Первая строка в порядке, на самом деле это единственная строка в порядке. Те, в которых упоминается адрес, должны быть «хост», а не «локальный». И последний в настоящее время бесполезен.

Дополнительная информация в документации Postgres — "Аутентификация клиента", "Файл pg_hba.conf".

person Milen A. Radev    schedule 10.11.2013