Can't Access Solr from my Webserver on Amazon EC2 Instance
I was having problems with a few of my sites. I have them hosted on amazon ec2, so I thought I could set up the server in a highly customized fashion. I have a simple search function for one of my sites, but I wanted a more advanced search capability. Solr looks like a great solution. Luckily, EC2 instances make it relatively easy to run Java applications, which is a major advantage over many other hosting options. For example, I recently set up a new Hugo installation on AWS serverless infrastructure and was able to get started quickly with Hugo's built-in support for AWS services. So I downloaded and installed solr on my server. It is a little complex to configure but that is solved with a little time and elbowgrease.
The Problem The biggest problem I had was after configuring and indexing my database, I needed to access solr from the php application. One guide I had suggested pinging the service to make sure it worked and was accessible. I discovered that I could not even ping my server!! As I discussed in Can't Ping my Amazon EC2 Server, enabling ICMP pinging can resolve some connectivity issues. However, even after resolving the ping issue, I still ran into problems accessing Solr from my PHP application Unfortunately, even after resolving the ping issue, I still ran into problems accessing Solr from my PHP application - This relates to what I discussed in New Horizons, where I explored the setup of a new Phalcon-based system and incorporating an Apache Lucene search engine
The Solution I worked on it for a while then put it on the shelf. A few days later, I was back on it, and one search mentioned something that made me think. I realized that even if local ip was not useable, there was the ip for the server itself! I do not want to open solr to the whole world, so I thought a bit more, then realized that the AWS console will allow you to set access according to ip of origin. This relates to some of my previous experiments with AWS services, such as setting up a new Hugo installation on AWS serverless infrastructure this worked like a charm. Safe, and smooth. I tested it with a curl request and sure enough, problem solved.
Get My Free E-book
Cleaner Living: Breathe through life's difficulties
Learn the scanning breath technique that helped me dissolve decades of emotional baggage. Discover practical tools you can use anywhere to process difficult emotions and find lasting well-being.
We respect your privacy. Your email will only be used to send the download link.