-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] PHP error "Exception: No alive nodes found in your cluster" #162
Comments
Does it work with plain curl? |
@shyim No I am getting: |
After upgrading to Docker v24.0.4 and php v8.2-FPM, we can now curl to it and get |
can you show how do you connected with python sdk? |
Sure,
|
After upgrading docker and php and curl is working well, I now get "UNAUTHORIZED" from opensearch with the same credentials that work for python. Here is the code:
Here is what that returns:
|
@edgypet i've got the same unauthorized issue using AWS OpenSearch Service within a VPC but curl was connected successfully. In my case setting |
adding port in host url |
Hello @edgypet, |
What is the bug?
I can connect to my OpenSearch instance through telnet, curl, and through the OpenSearch python SDK, but not PHP.
Here is the full error:
Fatal error: Uncaught OpenSearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster in /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php:67 Stack trace: #0 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php(85): OpenSearch\ConnectionPool\StaticNoPingConnectionPool->nextConnection() #1 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php(102): OpenSearch\Transport->getConnection() #2 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(292): OpenSearch\Transport->performRequest() #3 /var/www/html/vendor/react/promise/src/FulfilledPromise.php(28): OpenSearch\Connections\Connection->OpenSearch\Connections\{closure}() #4 /var/www/html/vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php(65): React\Promise\FulfilledPromise->then() #5 /var/www/html/vendor/ezimuel/ringphp/src/Core.php(341): GuzzleHttp\Ring\Future\CompletedFutureValue->then() #6 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(340): GuzzleHttp\Ring\Core::proxy() #7 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(238): OpenSearch\Connections\Connection->OpenSearch\Connections\{closure}() #8 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php(113): OpenSearch\Connections\Connection->performRequest() #9 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php(1392): OpenSearch\Transport->performRequest() #10 /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php(698): OpenSearch\Client->performRequest() #11 /var/www/html/opensearchtest.php(29): OpenSearch\Client->info() #12 /var/www/html/index.php(268): require('...') #13 {main} thrown in /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php on line 67
How can one reproduce the bug?
Set-up EC2 instance on a VPC with a security group for open internal access.
Create an OpenSearch cluster on same vpc, security group, and subnet with Fine-graned access control with a user/pass
Install composer version 2.2 of OpenSearch-php:
"opensearch-project/opensearch-php": "^2.2",
Run simple php test script:
`<?php
require dirname(FILE).'/vendor/autoload.php';
ini_set('display_errors', '1');
use OpenSearch\ClientBuilder;
$client = (new \OpenSearch\ClientBuilder())
->setHosts(['https://vpc-[YOURINSTANCE].us-east-1.es.amazonaws.com:443'])
->setBasicAuthentication(OPENSEARCH_USER, OPENSEARCH_PASS)
->setSSLVerification(false) // For testing only. Use certificate for validation
->build();
var_dump($client->info());
die();
?>
`
What is the expected behavior?
It should return information on my OpenSearch cluster
What is your host/environment?
php -v PHP 8.1.20 (cli) (built: Jun 14 2023 05:51:39) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.20, Copyright (c) Zend Technologies with Zend OPcache v8.1.20, Copyright (c), by Zend Technologies
cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
Do you have any additional context?
I have tried the above on both ports 443 and 9200. Python OpenSearch SDK can connect on port 443.
The text was updated successfully, but these errors were encountered: