[英]Run elasticsearch in terminal in any directory with command “elasticsearch”
On my previous Mac laptop I was able to run elasticsearch in terminal in any directory with the command "elasticsearch".在我以前的 Mac 笔记本电脑上,我可以使用命令“elasticsearch”在任何目录的终端中运行 elasticsearch。 Now I have to scroll to the elasticsearch install directory and run a particular file.
现在我必须滚动到 elasticsearch 安装目录并运行特定文件。
Could someone help me set up a command so I can just type "elasticsearch" wherever I am, and the service will start to run, as it was previously?有人可以帮我设置一个命令,这样我就可以在任何地方输入“elasticsearch”,服务就会像以前一样开始运行?
You can simply create an alias in your mac profile( latest version of mac uses.zshrc ) like below.您可以简单地在您的 mac 配置文件( 最新版本的 mac uses.zshrc )中创建一个别名,如下所示。
Assuming you have installed Elasricsearch using the tar file as you mentioned you have to go to a particular dir(bin) in this case.假设您已经使用您提到的 tar 文件安装了 Elasricsearch,在这种情况下,您必须将 go 安装到特定的 dir(bin)。
alias elasticsearch='./path/to/bin/foler/elasticsearch'
Please note, you need to run source ~/.zshrc
to make sure alias is loaded.请注意,您需要运行
source ~/.zshrc
以确保已加载别名。 Let me know if you face any issue, help to help further.如果您遇到任何问题,请告诉我,帮助进一步提供帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.