etsy / 411

An Alert Management Web Application
https://demo.fouroneone.io
MIT License
971 stars 112 forks source link

No alive nodes found in your cluster #67

Closed elvarb closed 8 years ago

elvarb commented 8 years ago

I set up 411 on a Centos 7 machine with PHP 5.6 and I keep getting no alive nodes errors when I load the page. For example calling /api/dashboard gives this in the log

[Mon Oct 17 14:02:32.205576 2016] [:error] [pid 15096] [client 172.25.111.16:1105] except [NONE] Elasticsearch\\Common\\Exceptions\\NoNodesAvailableException: "No alive nodes found in your cluster" at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php:51] 0:[Elasticsearch\\ConnectionPool\\StaticNoPingConnectionPool->nextConnection() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php:71]] 1:[Elasticsearch\\Transport->getConnection() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php:89]] 2:[Elasticsearch\\Transport->performRequest() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:230]] 3:[Elasticsearch\\Connections\\Connection->Elasticsearch\\Connections\\{closure}() called at [/opt/411/vendor/react/promise/src/FulfilledPromise.php:25]] 4:[React\\Promise\\FulfilledPromise->then() called at [/opt/411/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php:55]] 5:[GuzzleHttp\\Ring\\Future\\CompletedFutureValue->then() called at [/opt/411/vendor/guzzlehttp/ringphp/src/Core.php:341]] 6:[GuzzleHttp\\Ring\\Core::proxy() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:283]] 7:[Elasticsearch\\Connections\\Connection->Elasticsearch\\Connections\\{closure}() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:159]] 8:[Elasticsearch\\Connections\\Connection->performRequest() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php:106]] 9:[Elasticsearch\\Transport->performRequest() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php:80]] 10:[Elasticsearch\\Endpoints\\AbstractEndpoint->performRequest() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/BooleanRequestWrapper.php:34]] 11:[Elasticsearch\\Namespaces\\BooleanRequestWrapper::performRequest() called at [/opt/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php:919]] 12:[Elasticsearch\\Namespaces\\IndicesNamespace->existsTemplate() called at [/opt/411/phplib/ESClient.php:71]] 13:[FOO\\ESClient->initializeIndex() called at [/opt/411/phplib/ESClient.php:31]] 14:[FOO\\ESClient->__construct() called at [/opt/411/phplib/REST/Dashboard.php:16]] 15:[FOO\\Dashboard_REST->GET() called at [/opt/411/phplib/REST.php:107]] 16:[FOO\\REST->route() called at [/opt/411/htdocs/api/dashboard.php:6]]

The config.php for ES looks like this

`$config['elasticsearch'] = [

Configuration for the 411 Alerts index.

'alerts' => [
    'hosts' => [ 'http://elasticsearch.lan:9200' ],
    'index_hosts' => [],
    'ssl_cert' => null,
    'index' => null,
    'date_based' => false,
    'date_field' => 'alert_date',
    'src_url' => null,
],
# Configuration for the logstash index that 411 queries.
'logstash' => [
    'hosts' => [ "http://elasticsearch.lan:9200" ],
    'index_hosts' => [],
    'ssl_cert' => null,
    'index' => 'logstash',
    'date_based' => true,
    'date_field' => '@timestamp',
    'src_url' => null,
],

];`

I can curl to the elasticsearch url from the 411 node so it is not blocked

Solution is simple, you probably have SELInux active and it is blocking outgoing connections from the httpd service

Do sudo yum install policycoreutils-python sudo semanage port -a -t http_port_t -p tcp 9200

Just nice to have this documented in the issue tracker here if someone else has this problem

kiwiz commented 8 years ago

Great, thanks. :]

On Mon, Oct 17, 2016, 10:36 elvarb notifications@github.com wrote:

Closed #67 https://github.com/etsy/411/issues/67.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etsy/411/issues/67#event-826025074, or mute the thread https://github.com/notifications/unsubscribe-auth/AC-jwlpbnv4VUWQg7LI5D_q0NBQGSJerks5q04fUgaJpZM4KYsrE .

profilernz commented 8 years ago

I've also had to run this on Centos 7: chcon -v -t httpd_sys_content_rw_t data.db to allow writes to the db...

elvarb commented 8 years ago

@profilernz ran into the database problem as well, good to document the solution as well

Also worth noting that Centos only provides php5.4 but 411 requires a newer version. Not a fun process to get it installed on Centos.

profilernz commented 8 years ago

@elvarb Indeed no fun, but I used the IUS repo and it wasn't too hard. For the record again:

yum install https://centos7.iuscommunity.org/ius-release.rpm yum install php56u php56u-posix php56u-pdo php56u-xml php56u-mbstring