How to shut down rethinkdb running on Mac OSX - macos

Note: We love RethinkDB but our current project does not use it so we need to free up resources on our local machine ...
We installed RethinkDB using homebrew:
brew update && brew install rethinkdb
And added the rethinkdb process to our plist as per the instructions in:
http://rethinkdb.com/docs/start-on-startup/
But now we need to shut it down to free-up the 8080 port for another service.
What command do we need to run? (thanks!)

Do this in the terminal
check to see if you started it using brew
$ brew services list
stop rethinkdb:
$ brew services stop rethinkdb
restart:
$ brew services start rethinkdb

Like this, I think, if you used launchctl:
sudo launchctl unload -w /Library/LaunchDaemons/com.rethinkdb.server.plist

Related

How do I install redis 5.0.14 using homebrew

I need to install redis version 5.0.14 on my mac using brew.
I have tried multiple ways like brew install redis#5.0.14, redis#5.0, redis#50, redis#5 but nothing seems to work!!
I was able to find out on https://formulae.brew.sh/ that the options that can be installed using brew are redis, redis#4.0, redis#3.2 . But I need to install redis 5.0.14 or basically above 5.0.6 because that is the version we have on our production. Can anyone help me out on this?
I have seen a way here that suggests to checkout specific homebrew formulae version but that would become too messy if something goes wrong. I would prefer a straight forward way if there is one.
Given that the Redis version you require is not available via homebrew, your question is unanswerable. However, given how good docker is on macOS, I have taken to using that rather than homebrew for lots of version-related problems.
With docker:
I can pull any version I want,
it's all isolated from my core macOS,
just as performant,
readily deletable,
simple to have many versions,
switchable between versions,
repeatable across platforms and
configurable by script.
Official image here.
So, in concrete terms, you could run Redis 5.0.14 as a daemon like this:
docker run --name some-redis -d redis:5.0.14
and then connect to that same container and run redis-cli inside it like this:
docker exec -it some-redis redis-cli PING
PONG
Or you could run Redis in the container but expose its port 6379 as port 65000 to your regular macOS applications like this:
docker run --name some-redis -p 65000:6379 -d redis:5.0.14
Then it is accessible to your macOS applications, such as redis-cli like this:
redis-cli -p 65000 info | grep redis_version
redis_version:5.0.14
The version you're looking for is not available on brew unfortunately.
bruno#pop-os ~> brew info --json redis | jq -r '.[].versioned_formulae[]'
redis#4.0
redis#3.2
You could get the source code from here: https://github.com/redis/redis/releases/tag/5.0.14
extract it to some directory, to run Redis with the default configuration just type:
% cd src
% ./redis-server
If you want to provide your redis.conf, you have to run it using an additional
parameter (the path of the configuration file):
% cd src
% ./redis-server /path/to/redis.conf
It is possible to alter the Redis configuration by passing parameters directly
as options using the command line. Examples:
% ./redis-server --port 9999 --replicaof 127.0.0.1 6379
% ./redis-server /etc/redis/6379.conf --loglevel debug
All the options in redis.conf are also supported as options using the command
line, with exactly the same name.
Optionally you could use Docker, docker run --name some-redis -d redis:5.0.14
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
To stop it, just run:
brew services stop redis
Test if Redis server is running.
redis-cli ping

Cannot start jenkins-lts on mac using homebrew

I am trying to install/run jenkins on a mac machine using homebrew. This is what I did
brew install jenkins-lts
On running this command. I see that jenkins-lts is installed and I see this message
Note: When using launchctl the port will be 8080.
To have launchd start jenkins-lts now and restart at login:
brew services start jenkins-lts.
Or, if you don't want/need a background service you can just run:
jenkins-lts
If I run jenkins-lts, Jenkins starts at port 8080 successfully. I can reach it from the browser.
If I run brew services start jenkins-lts . I see the message
Successfully started jenkins-lts (label:homebrew.mxcl.jenkins-lts)
But I cannot reach the server on port 8080. I tried checking the status of the service
I tried checking the status of the service brew services list
Name Status User Plist
jenkins-lts unknown ec2-user /Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist
I see that status is unknown.
After a while I see that this service is not listed anymore in the brew services list command. If I try to start it again. I see this message
/Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist: service already loaded
Error: Failure while executing; /bin/launchctl bootstrap gui/501 /Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist exited
with 37
Where can I find the jenkins logs and how to get it working.
likely you have not configured you host setings
so after starting the service
use
http://127.0.0.1:8080/
not
http://localhost:8080/
This is my experience , brew services list showed up as :
Name Status User Plist
jenkins-lts error cskjk16 /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.#CD6R ~
and the fix was:
1. brew services stop jenkins-lts
2. brew services start jenkins-lts
and now brew services list showed up as :
Name Status User Plist
jenkins-lts started cskjk16 /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.#CD6R ~
My solution was to uninstall Jenkins using brew (brew uninstall jenkins-lts), followed by brew doctor, followed by brew clanup, and re-install jenkins (brew install jenkins-lts).
After, I was able to start Jenkins using brew services start jenkins-lts.
Your password will be available at $ cat /User/..../.jenkins/secrets/initialAdminPassword.
Use it to create the admin account and continue the configuration.
The issue here is that, macos was running as a dedicated host on AWS.
I was connected to this macos from my windows machine using putty and trying to run the command.
brew services start jenkins-lts
This does not work. I had to login to macos via some Remote Desktop client like VNC and then run the same command from the the terminal window of mac.
In some cases, there will be a pop up which you needs user input. Hence this did not work when I was connected via putty from my windows machine.
We had the same issues on MacBooks and this is what fixed it.
run this:
chmod u+w /usr/local/var/log
and then run this:
sudu chown -R $(whoami) /usr/local/var/log
then:
brew install jenkins-lts
and it worked

Can't change document root for apache 2.4

I want to set up local web server using Apache and PHP on my Mac running Sierra. I followed this tutorial:
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
And I am stuck at changing the document root from httpd.config, for whatever reason this change does not take effect at all. If I type http://localhost it still says "It works", it still uses the original html file.
Another weird thing is that apparently I can't stop apache at all. I tried running
$ sudo apachectl stop
but I still can’t access http://localhost
if I run
$ brew services list
httpd24 is stopped. What gives? What am I doing wrong?
There is an instance of apache pre-installed with macOS. So you have now two versions of apache installed. If you check:
which apachectl
you will probably obtain:
/usr/sbin/apachectl
which is the official macOS version of apachectl. Stop it with:
sudo apachectl stop
Disable the auto-loading of the pre-installed apache with (as explained in the tutorial you mentioned):
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
To run the homebrew version do:
brew services run httpd24
to stop it:
brew services stop httpd24
to register it to launch at login:
brew services start httpd24

Start / Stop MongoDB with Homebrew

I am using mac osx 10.10.5
This question has been asked many times before and after following the steps, I notice bizarre behavior.
These are the steps which I have taken
brew tap gapple/services
brew install mongodb
This installs the product and now when I do brew services list I can see mongodb in a stopped state.
When I tried to start the process by brew services start mongodb I get an error
Error: Could not read the plist for mongodb!
OK. I googled a solution
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/3.0.6/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
Now as soon as the file is copied, when I do brew services list ... the mongo process is automatically running.
Now when I do brew services stop mongodb
It says
Error: Service `mongodb` not running, wanna start it? Try `brew services start mongodb`
Now this is bizarre, because just in the last step it said its running. Now when I do
mongodb services list it says that the service is stopped. (so the stop command above did work. Even though it threw an error).
Now if I do
brew services start mongodb
It gives error Error: Could not read the plist for mongodb!
Now if I copy the file again
cp /usr/local/Cellar/mongodb/3.0.6/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
The service automatically begins to run.
I find this whole thing really bizarre. All I want is a clean way to start stop the mongo db service. And although there are many threads on this site (and elsewhere) ... they don't work or just have strange behavior.
brew services start/restart/stop mongodb-community#4.0
For me I had multiple version of mongodb and when I tried to switching between them, I got this error
Error: Could not read the plist for `mongodb26`!
This is what I did to start mongodb26 service.
brew unlink mongodb24
brew link mongodb26
brew services start mongodb26
You can list services by doing
brew services list
and then as one of the answers said brew services start [NAME] or brew services stop [NAME]
I think you should look at their Github repo on this. I gapple/services is deprecated. This might be a more up to date options.
You should use instead: brew services stop mongodb-community#4.2, don't forget to mention the version of MongoDB you installed and using for your purposes.
If you still facing issues, follow this link: Click here
inside of Hombrew Simple way is to get the process id of MongoDB and kill it.
get the pid:
pgrep mongo
then kill with this command
kill <pid>

Installed memcached via homebrew, how to start and stop server?

I have memcached installed via homebrew.
how do I start/stop the server?
Any command-line tools to interact with memcached?
does homebrew have a way of removing a package?
When you installed it, it put a file named homebrew.mxcl.memcached.plist in /usr/local/Cellar/memcached/$version/; you copy that file into ~/Library/LaunchAgents and then tell launchd to start it with launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist.
If you were watching the console carefully during the brew install command, it should have said something about doing these exact steps. If you run brew info it'll re-print this information, e.g. brew info memcached.
You should probably read https://docs.brew.sh/Manpage -- it has more useful documentation including the brew remove command which will remove the package if you decide you don't want it.
Brew used to have a command brew services (https://thoughtbot.com/blog/starting-and-stopping-background-services-with-homebrew), now deprecated. Instead, to get always-correct advice, run this command:
brew info memcached
Via telnet: telnet localhost 11211
See also What are some useful tips/tools for monitoring/tuning memcached health?
brew remove memcached
Additionally you can run "brew info", if you have forgotten about the instructions.
→ brew info memcached
memcached 1.4.7
http://memcached.org/
Depends on: libevent
/usr/local/Cellar/memcached/1.4.6 (8 files, 156K)
You can enable memcached to automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/memcached/1.4.7/com.danga.memcached.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist
Or start it manually:
/usr/local/bin/memcached
Add "-d" to start it as a daemon.
http://github.com/mxcl/homebrew/commits/master/Library/Formula/memcached.rb
To restart:
If you have the memcached starting up with launchd and your plist file has
<key>KeepAlive</key>
<true/>
Then you can just kill the process and it will reboot automagically.
ps ux | grep memcached
pkill -f memcached
ps ux | grep memcached
To stop launchd from restarting automatically:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
To add memcached to launchd again:
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
To uninstall something installed by homebrew:
brew uninstall memcached
And you can also create aliases
alias memcached-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist"
alias memcached-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist"
alias memcached-restart="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist;launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist"
and after that you cant easy start/stop/restart memcached
memcached-start
memcached-stop
memcached-restart
You can also use Lunchy to set the start/stop. Lunchy is a wrapper written over launchctl. I’ve written a detailed post about this.
$ gem install lunchy
$ mkdir ~/Library/LaunchAgents
$ cp /usr/local/Cellar/memcached/$version/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/
To start memcached
$ lunchy start memcached
To stop memcahed
$ lunchy stop memcached
You can enable Memcached to automatically load on login.
This first line creates a symlink (symbolic link) from where Homebrew installed it to the LaunchAgents folder.
ln -sfv /usr/local/Cellar/memcached/1.4.17/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/
Then to launch it now:
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist

Resources