开启&关闭各种服务

开启&关闭

Mac版

查找被占用的8080端口,根据pid杀掉进程

查找8080端口 losf -i:8080
根据pid杀掉进程 kill -9 pid

iMac:~ acui$ lsof -i:8080
COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    62948 ting   93u  IPv6 0x6697d67f7b95e1c1      0t0  TCP *:glrpc (LISTEN)
iMac:~ acui$ kill -9 62948

启动tomcat服务

启动服务 ./start.sh
关闭服务 ./shutdown.sh
验证 http://localhost:8080/

iMac:~ acui$ cd apache-tomcat-7.0.92/bin/
# 启动服务
iMac:bin acui$ ./startup.sh 
Using CATALINA_BASE:   /Users/acui/apache-tomcat-7.0.92
Using CATALINA_HOME:   /Users/acui/apache-tomcat-7.0.92
Using CATALINA_TMPDIR: /Users/acui/apache-tomcat-7.0.92/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
Using CLASSPATH:       /Users/acui/apache-tomcat-7.0.92/bin/bootstrap.jar:/Users/acui/apache-tomcat-7.0.92/bin/tomcat-juli.jar
Tomcat started.
# 关闭服务
iMac:bin acui$ ./shutdown.sh
Using CATALINA_BASE:   /Users/acui/apache-tomcat-7.0.92
Using CATALINA_HOME:   /Users/acui/apache-tomcat-7.0.92
Using CATALINA_TMPDIR: /Users/acui/apache-tomcat-7.0.92/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
Using CLASSPATH:       /Users/acui/apache-tomcat-7.0.92/bin/bootstrap.jar:/Users/acui/apache-tomcat-7.0.92/bin/tomcat-juli.jar

启动和关闭zookeeper服务

启动服务 ./zkServer.sh start
关闭服务 ./zkServer.sh stop

iMac:~ acui$ cd zookeeper-3.4.13/bin
# 启动服务
iMac:bin acui$ ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /Users/acui/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
# 关闭服务
iMac:bin acui$ ./zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /Users/acui/zookeeper-3.4.13/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED

参考:ZooKeeper Getting Started Guide

启动和关闭redis服务

iMac:~ acui$ cd /usr/local/redis-3.2.12/src
iMac:src acui$ redis-server
3354:C 18 Feb 18:45:47.391 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
3354:M 18 Feb 18:45:47.393 * Increased maximum number of open files to 10032 (it was originally set to 256).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.2.12 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 3354
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

3354:M 18 Feb 18:45:47.398 # Server started, Redis version 3.2.12
3354:M 18 Feb 18:45:47.398 * The server is now ready to accept connections on port 6379

# 强行关闭
iMac:~ acui$ ps axu|grep redis
acui              3599   0.3  0.0  2442020   1936 s002  S+    6:53下午   0:00.00 grep redis
acui              3354   0.0  0.0  2462204   3188 s001  S+    6:45下午   0:00.30 redis-server *:6379
iMac:~ acui$ kill -9 3354

# 命令关闭

参考:mac下redis安装、设置、启动停止

启动activemq服务

启动服务 activemq start
关闭服务 activemq stop
验证 http://localhost:8161 (默认用户名密码是admin/admin)

# 启动服务
iMac:~ acui$ sudo activemq start
Password:
INFO: Loading '/usr/local/Cellar/activemq/5.15.8/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.8/libexec//data/activemq.pid' (pid '4195')
# 关闭服务
iMac:~ acui$ sudo activemq stop
Password:
INFO: Loading '/usr/local/Cellar/activemq/5.15.8/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid '4195' : 
Java Runtime: Oracle Corporation 1.8.0_171 /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre
  Heap sizes: current=62976k  free=61992k  max=932352k
    JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/usr/local/Cellar/activemq/5.15.8/libexec//conf/login.config -Dactivemq.classpath=/usr/local/Cellar/activemq/5.15.8/libexec//conf:/usr/local/Cellar/activemq/5.15.8/libexec//../lib/: -Dactivemq.home=/usr/local/Cellar/activemq/5.15.8/libexec/ -Dactivemq.base=/usr/local/Cellar/activemq/5.15.8/libexec/ -Dactivemq.conf=/usr/local/Cellar/activemq/5.15.8/libexec//conf -Dactivemq.data=/usr/local/Cellar/activemq/5.15.8/libexec//data
Extensions classpath:
  [/usr/local/Cellar/activemq/5.15.8/libexec/lib,/usr/local/Cellar/activemq/5.15.8/libexec/lib/camel,/usr/local/Cellar/activemq/5.15.8/libexec/lib/optional,/usr/local/Cellar/activemq/5.15.8/libexec/lib/web,/usr/local/Cellar/activemq/5.15.8/libexec/lib/extra]
ACTIVEMQ_HOME: /usr/local/Cellar/activemq/5.15.8/libexec
ACTIVEMQ_BASE: /usr/local/Cellar/activemq/5.15.8/libexec
ACTIVEMQ_CONF: /usr/local/Cellar/activemq/5.15.8/libexec/conf
ACTIVEMQ_DATA: /usr/local/Cellar/activemq/5.15.8/libexec/data
Connecting to pid: 4195
.....Stopping broker: localhost
.. TERMINATED

参考:mac 使用Homebrew安装ActiveMQ

Linux版

posted @ 2019-02-19 01:42  亭子亭子大亭子  阅读(414)  评论(0编辑  收藏  举报