Monitoring Solr using Monit - ruby-on-rails-3

I'm new to Solr and Monit. I have a Rails 3.2 app with Solr, how do you configure monit to handle Solr?
Cheers, and Thanks,
Zeck

To handle solr using monit you need to config it in the monitrc file which is present in /etc/monit/ directory.
Go to the directory
1) cd /etc/monit
and edit the monitrc file using sudo.
2) sudo nano monitrc
At the end of the file past the code given in the link
https://gist.github.com/SammyLin/cc367a8a2fe552bcbb1f
Save the file and reload the monit using
3) sudo monit reload
Now monit will take care of the solr.

Related

How to stop the running solr server?

I want to stop Solr server which is been started with below command
$ solr start -e dih
by above command my intention was to launch example DIH application bundled with the package.
Now I want to stop the above server, when I try to stop, I am getting below error:
$ solr stop -p 8984
ERROR: Solr home directory D:\Softwares\solr-5.0.0\ must contain
solr.xml
I am new to Solr.
i had set the SOLR_HOME as solr\bin, but where as per the document , it says
The Solr Home directory typically contains the following...
solr.xml *
so i have set SOLR_HOME to solr\server\solr, where i have solr.xml.
after modifying my home to above path, solr stop starts working

Clear apache log or change log while apache is running

I want to clear my Apache log without stopping apache or anything like that, but I have a problem while apache's running I can not edit the active log file.
I attempted some solutions but all is not good, or it just does not work - for example:
cat /dev/null > /path/to/log.log
It works but it kills the CPU.
Now I want to know has anybody got a good solution for clearing log files or creating a new log file with a new name every N hours which doesn't kill the CPU,RAM,etc ...
What can I do? Please give me a solution :((
Kind regards.
Install and set up logrotate, assuming you are on a debian or ubuntu distribution do this :
$ sudu apt-get install logrotate
This is an "industry standard" solution for what you want to achieve.
Recommended reading:
http://articles.slicehost.com/2010/6/30/understanding-logrotate-on-ubuntu-part-1
http://articles.slicehost.com/2010/6/30/understanding-logrotate-on-centos-part-1
https://unix.stackexchange.com/questions/66292/learning-about-general-logging-logrotation-on-linux

Delete old tmp file when Apache starts

I'm using Bitnami MAMP Stack on OSX and would like to clear the tmp directory whenever I start the Apache Web Server.
So basically I need to know where to add the following command, or a script containing the command rm -rf ~/Library/Containers/com.bitnami.mampstack/Data/app/php/tmp.
Takk,
Robert.
Just look inside your MAMP program folder. There is ./bin/start.sh
Just add you line to this.
Or to startApache.sh if you want to execute only with Apache restarts.

what happen if i delete apache log file?

I have 4 files in /var/log/apache2 and I just deleted 2 of them (I do have backups). would it affect apache's logging capabilities? does apache automatically create files and write to them if they don't exist?
It will create new file automatically.
The file is deleted but the file handle remains until you reload/restart apache, at least on Rhel 7.
You can verify this by running sudo lsof | grep access_log after deleting /var/log/httpd/access_log.
You might see the file automatically getting recreated some time later when logrotate runs, as that issues a reload which would then trigger the file to be created again.

Phusion Passenger ngnix.conf location

I have a Rails 3 application that uses Phusion Passenger. I install the standalone version of Passenger using the command "gem install passenger" on my Macintosh MacBook Pro. The application works fine. Now, I want to change some configurations for the ngnix server but I can not find the location of the ngnix.conf file. I have looked in /usr/local and /opt/ and /etc/. Can someone assist me in either finding or creating the ngnix.conf?
Thanks
Look for the nginx.conf file in /opt/nginx/conf
You must have su privileges to edit this file.
Remember to stop and start nginx after making your changes