Versions
- Magento: 2.4.4
- Opensearch: 1.2.4
- Valet 2.3.1
- PHP 7.4
- Docker 4.10.1
- Curl 7.79.1
Heres the error I get when I try to curl
$ curl -u admin:admin -i https://localhost:9200/_cluster/health
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
it works if I use --insecure
tag in my curl but it doesn’t allow that in Magento so I’m not really sure what to do.
Heres the error I get running an reindex or setup upgrade in Magento
Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
Here are my elasticsearch settings in my Magento2 env.php file
'elasticsearch7_server_hostname' => 'https://localhost',
'elasticsearch7_server_port' => '9200',
'elasticsearch7_index_prefix' => 'test',
'elasticsearch7_enable_auth' => '1',
'elasticsearch7_server_timeout' => '15',
'elasticsearch7_username' => 'admin',
'elasticsearch7_password' => 'admin'
But it wont make an connection in Magento because the port 9200 doesn’t have valid certificate even though my root domain does. I’ve got my Magento site running in Valet and my opensearch is running via a docker container.
Can someone please help I’ve trying to fix these for so long, I’m pretty new to posting on here so if I’ve missed any info just say and I’ll add it on.
Cheers.
UPDATE:
I’ve tried to use this approach https://opensearch.org/docs/latest/security-plugin/configuration/disable/ but for some reason I don’t have a opensearch.yml or an opensearch folder for that matter even though it listed in my docker file
$ cd /usr/share/opensearch
cd: no such file or directory: /usr/share/opensearch
My docker-compose.yml
opensearch-node1:
image: opensearchproject/opensearch:1.2.4
container_name: opensearch-node1
environment:
- cluster.name=opensearch-cluster
- node.name=opensearch-node1
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- cluster.initial_master_nodes=opensearch-node1,opensearch-node2
- bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536 # maximum number of open files for the OpenSearch user, set to at least 65536 on modern systems
hard: 65536
volumes:
- opensearch-data1:/usr/share/opensearch/data
ports:
- 9200:9200
- 9600:9600 # required for Performance Analyzer
networks:
- opensearch-net
2
Answers
The config file is in /etc/opensearch folder
I know maybe I am too late, but you can disable the HTTPS using
plugins.security.disabled=false
. For example, if you follow the opensearch documentation for docker, when it shows you the command to run the container, just add theplugins.security.disabled=false
:docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "plugins.security.disabled=true" opensearchproject/opensearch:latest
This way I can work in my local machine using
http://localhost:9200
.