Chef-Server:在资源上执行“run”操作时出错'执行[create_database_opscode-pgsql]'

时间:2015-12-14 11:32:09

标签: chef

请帮我解决以下问题。

注意:一段时间后工作正常。

错误

execute[create_database_opscode-pgsql] action run

      ================================================================================
      Error executing action `run` on resource 'execute[create_database_opscode-pgsql]'
      ================================================================================

      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '1'
      ---- Begin output of createdb --template template0 --encoding UTF-8 opscode-pgsql ----
      STDOUT: 
      STDERR: createdb: could not connect to database template1: could not connect to server: Connection refused
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
      ---- End output of createdb --template template0 --encoding UTF-8 opscode-pgsql ----
      Ran createdb --template template0 --encoding UTF-8 opscode-pgsql returned 1

      Resource Declaration:
      ---------------------
      # In /opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/providers/pg_database.rb

       13:   execute "create_database_#{new_resource.database}" do
       14:     command createdb_command
       15:     user node['private_chef']['postgresql']['username']
       16:     not_if {database_exist?}
       17:     retries 30
       18:   end
       19: end

      Compiled Resource:
      ------------------
      # Declared in /opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/providers/pg_database.rb:13:in `block in class_from_file'

      execute("create_database_opscode-pgsql") do
        action [:run]
        retries 30
        retry_delay 2
        default_guard_interpreter :execute
        command "createdb --template template0 --encoding UTF-8 opscode-pgsql"
        backup 5
        returns 0
        user "opscode-pgsql"
        declared_type :execute
        cookbook_name "private-chef"
        not_if { #code block }
      end


    ================================================================================
    Error executing action `create` on resource 'private_chef_pg_database[opscode-pgsql]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    execute[create_database_opscode-pgsql] (/opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/providers/pg_database.rb line 13) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
    ---- Begin output of createdb --template template0 --encoding UTF-8 opscode-pgsql ----
    STDOUT: 
    STDERR: createdb: could not connect to database template1: could not connect to server: Connection refused
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
    ---- End output of createdb --template template0 --encoding UTF-8 opscode-pgsql ----
    Ran createdb --template template0 --encoding UTF-8 opscode-pgsql returned 1
-----------------------------

[root@vm-126a-f683 data]# ps auxw | grep post
root      9548  0.0  0.0   3684   348 ?        Ss   16:08   0:01 runsv postgresql
opscode   9553  0.0  0.0   3828   488 ?        S    16:08   0:00 svlogd -tt /var/log/opscode/postgresql/9.2
496      17180  0.0  0.9 2146852 75632 ?       Ss   18:25   0:00 /opt/opscode/embedded/bin/postgres -D /var/opt/opscode/postgresql/9.2/data
496      17182  0.0  0.0 2147852 1208 ?        Ss   18:25   0:00 postgres: checkpointer process                                            
496      17183  0.0  0.1 2147852 14136 ?       Ss   18:25   0:00 postgres: writer process                                                  
496      17184  0.0  0.0 2147852 1136 ?        Ss   18:25   0:00 postgres: wal writer process                                              
496      17185  0.0  0.0 2149208 2576 ?        Ss   18:25   0:00 postgres: autovacuum launcher process                                     
496      17186  0.0  0.0  24556  1364 ?        Ss   18:25   0:00 postgres: stats collector process                                         
root     19606  0.0  0.0  61204   768 pts/0    S+   19:03   0:00 grep post

请帮助解决这个问题,如果我遗漏了任何内容,请告诉我

1 个答案:

答案 0 :(得分:0)

Postgres没有运行。重新启动它。