開啓&關閉各類服務

開啓&關閉

Mac版

查找被佔用的8080端口,根據pid殺掉進程

查找8080端口 losf -i:8080
根據pid殺掉進程 kill -9 pidhtml

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/java

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 stoplinux

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 Guideweb

啓動和關閉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安裝、設置、啓動中止redis

啓動activemq服務

啓動服務 activemq start
關閉服務 activemq stop
驗證 http://localhost:8161 (默認用戶名密碼是admin/admin)apache

# 啓動服務
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安裝ActiveMQbootstrap

Linux版

相關文章
相關標籤/搜索