通过自制程序安装了memcached,如何启动和停止服务器?

发布于 2024-11-13 21:57:53 字数 148 浏览 3 评论 0原文

我通过自制软件安装了memcached。

  1. 如何启动/停止服务器?

  2. 有任何可以与 memcached 交互的命令行工具吗?

  3. 自制程序有删除软件包的方法吗?

I have memcached installed via homebrew.

  1. how do I start/stop the server?

  2. Any command-line tools to interact with memcached?

  3. does homebrew have a way of removing a package?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

菊凝晚露 2024-11-20 21:57:53

当你安装它时,它会在 /usr/local/Cellar/memcached/$version/ 中放置一个名为 homebrew.mxcl.memcached.plist 的文件;您将该文件复制到 ~/Library/LaunchAgents 中,然后告诉 launchd 使用 launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist 启动它。

如果您在执行 brew install 命令期间仔细观察控制台,它应该会说明有关执行这些具体步骤的信息。如果您运行brew info,它将重新打印此信息,例如brew info memcached

您可能应该阅读 https://docs.brew.sh/Manpage - 它有更多有用的文档包括 brew remove 命令,如果您决定不需要它,该命令将删除该包。

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.

躲猫猫 2024-11-20 21:57:53
  1. Brew曾经有命令brew服务(https://thoughtbot.com/blog/starting-and-stopping-background-services-with-homebrew),现已弃用。相反,要获得始终正确的建议,请运行以下命令:

    brew 信息 memcached
    
  2. 通过 telnet:telnet localhost 11211

    另请参阅有哪些有用的提示/ 用于监控/调整 memcached 运行状况的工具?

  3. brew 删除 memcached

  1. 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
    
  2. Via telnet: telnet localhost 11211

    See also What are some useful tips/tools for monitoring/tuning memcached health?

  3. brew remove memcached

骄傲 2024-11-20 21:57:53

此外,如果您忘记了说明,您可以运行“brew info”。

→ 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

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
七七 2024-11-20 21:57:53

重新启动:
如果你的memcached是用launchd启动的,并且你的plist文件有

  <key>KeepAlive</key>
  <true/>

那么你可以杀死这个进程,它会自动重新启动。

ps ux | grep memcached
pkill -f memcached
ps ux | grep memcached

要阻止 launchd 自动重新启动:

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist

要再次将 memcached 添加到 launchd:

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist

要卸载由 homebrew 安装的内容:

brew uninstall memcached

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
压抑⊿情绪 2024-11-20 21:57:53

您还可以创建别名

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"

,之后您就无法轻松启动/停止/重新启动 memcached

memcached-start
memcached-stop
memcached-restart

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
浮华 2024-11-20 21:57:53

您还可以使用 Lunchy 设置开始/停止。 Lunchy 是一个基于 launchctl 编写的包装器。我写了一篇详细的帖子< /a> 关于这个。

$ gem install lunchy
$ mkdir ~/Library/LaunchAgents
$ cp /usr/local/Cellar/memcached/$version/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/

启动 memcached

$ lunchy start memcached

停止 memcached

$ lunchy stop memcached

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
笑看君怀她人 2024-11-20 21:57:53

您可以启用 Memcached 在登录时自动加载。

第一行创建一个符号链接(符号链接),从 Homebrew 安装位置到 LaunchAgents 文件夹。

ln -sfv /usr/local/Cellar/memcached/1.4.17/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/

然后立即启动它:

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文