MAC 自运维

    网络

    查看端口占用进程 lsof -i tcp:8080

    lsof -i tcp:8080
    

    查看端口占用并杀死进程

    kill -9 `lsof -i tcp:8080`
    

    刷新 DNS

    /usr/bin/dscacheutil -flushcache
    
    sudo killall -HUP mDNSResponder
    

    数据库

    mongodb

    启动 MongoDB mongod --config /usr/local/etc/mongod.conf

    mysql

    jansora@Jansora-MacbookPro ~ % mysql.server
    Usage: mysql.server  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]
    jansora@Jansora-MacbookPro ~ % mysql.server start
    Starting MySQL
     SUCCESS!
    jansora@Jansora-MacbookPro ~ % mysql.server status
     SUCCESS! MySQL running (1839)
    

    redis

    jansora@Jansora-MacbookPro ~ % brew install redis
    To have launchd start redis now and restart at login:
      brew services start redis
    Or, if you don't want/need a background service you can just run:
      redis-server /usr/local/etc/redis.conf
    

    中间件

    nginx

    Docroot is: /usr/local/var/www
    
    The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
    nginx can run without sudo.
    
    nginx will load all files in /usr/local/etc/nginx/servers/.
    
    To have launchd start nginx now and restart at login:
      brew services start nginx
    Or, if you don't want/need a background service you can just run:
      nginx
    

    openjdk@8

    ➜  backend git:(master) brew install openjdk@8
    ==> Downloading https://ghcr.io/v2/homebrew/core/libpng/manifests/1.6.37
    Already downloaded: /Users/jansora/Library/Caches/Homebrew/downloads/e6be7ba72607e72eff6fd2dc3cbad15128f3b3b35a78f2578706d2a8be708f8b--libpng-1.6.37.bottle_manifest.json
    ==> Downloading https://ghcr.io/v2/homebrew/core/libpng/blobs/sha256:7209cfe63b2e8fdbd9615221d78201bfac44405f5206f7b08867bcd0c6046757
    ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:7209cfe63b2e8fdbd9615221d78201bfac44405f5206f7b08867bcd0c6046757?se=2022-05-28T08%3A40%
    ######################################################################## 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/freetype/manifests/2.12.0
    ######################################################################## 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/freetype/blobs/sha256:3424dbc7bc95ec38890c3ff7b6bd3c6a1ed6e56a9a42814951076f4485516547
    ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:3424dbc7bc95ec38890c3ff7b6bd3c6a1ed6e56a9a42814951076f4485516547?se=2022-05-28T08%3A40%
    ######################################################################## 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/8/manifests/1.8.0.322
    ######################################################################## 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/8/blobs/sha256:2fe2f45f60039781d805766bce7cf91f35fdd7e816ab45a3f9421c35c72ee0ad
    ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:2fe2f45f60039781d805766bce7cf91f35fdd7e816ab45a3f9421c35c72ee0ad?se=2022-05-28T08%3A40%
    ######################################################################## 100.0%
    ==> Installing dependencies for openjdk@8: libpng and freetype
    ==> Installing openjdk@8 dependency: libpng
    ==> Pouring libpng--1.6.37.monterey.bottle.tar.gz
    🍺  /usr/local/Cellar/libpng/1.6.37: 27 files, 1.3MB
    ==> Installing openjdk@8 dependency: freetype
    ==> Pouring freetype--2.12.0.monterey.bottle.tar.gz
    🍺  /usr/local/Cellar/freetype/2.12.0: 67 files, 2.3MB
    ==> Installing openjdk@8
    ==> Pouring openjdk@8--1.8.0+322.monterey.bottle.tar.gz
    ==> Caveats
    For the system Java wrappers to find this JDK, symlink it with
      sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk
    
    openjdk@8 is keg-only, which means it was not symlinked into /usr/local,
    because this is an alternate version of another formula.
    
    If you need to have openjdk@8 first in your PATH, run:
      echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc
    
    For compilers to find openjdk@8 you may need to set:
      export CPPFLAGS="-I/usr/local/opt/openjdk@8/include"
    
    ==> Summary
    🍺  /usr/local/Cellar/openjdk@8/1.8.0+322: 782 files, 193.1MB
    ==> Running `brew cleanup openjdk@8`...
    Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
    Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
    ==> Caveats
    ==> openjdk@8
    For the system Java wrappers to find this JDK, symlink it with
      sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk
    
    openjdk@8 is keg-only, which means it was not symlinked into /usr/local,
    because this is an alternate version of another formula.
    
    If you need to have openjdk@8 first in your PATH, run:
      echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc
    
    For compilers to find openjdk@8 you may need to set:
      export CPPFLAGS="-I/usr/local/opt/openjdk@8/include"
    
    

    评论栏