常用命令

赖卓成2021年7月26日
大约 2 分钟

  • docker的redis多实例:
docker run -p 6378:6379 -d redis redis-server --appendonly yes
  • v2-ui
bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)
  • maven打包插件:

插件版本要和springboot一致

  <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.1.6.RELEASE</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
  • linux黑洞

    nohup java -jar xxx.jar >/dev/null 2>&1 &
    
  • Windows查看端口占用

    netstat -ano | findstr 8060 其中8060是我服务的端口号
    taskkill /pid 4344 -t -f 终止进程
    
  • OPENSSL:

    git config --global http.proxy 127.0.0.1:37062
    git config --global https.proxy 127.0.0.1:37062
    再
    git config --global --unset http.proxy
    git config --global --unset https.proxy
    
  • 查ip的api

    http://api.k780.com/?app=ip.local&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json
    
  • docker安装nacos

    docker pull nacos/nacos-server
    docker run --env MODE=standalone --name nacos -d -p 8848:8848 nacos/nacos-server
    
  • docker安装redis

    # 创建配置、数据、日志目录
    sudo mkdir -p /docker/redis/{conf,data,logs}
    
    # 生成配置文件(精简版)
    sudo tee /data/redis/conf/redis.conf <<'EOF'
    bind 0.0.0.0                 # 允许所有IP访问[1,4](@ref)
    protected-mode no             # 关闭保护模式[7](@ref)
    requirepass yourpassword      # 设置强密码(非默认)[4,6](@ref)
    appendonly yes                # 开启AOF持久化[2,7](@ref)
    dir /data                    # 持久化文件存储路径[6](@ref)
    logfile "/logs/redis.log"    # 日志文件路径[6](@ref)
    EOF
    
    # 删除旧容器(确保数据已备份)
    docker rm -f redis
    
    # 重建目录并精确赋权
    sudo rm -rf /docker/redis
    sudo mkdir -p /docker/redis/{conf,data,logs}
    
    # 获取 Redis 镜像默认用户 UID:GID(通常为 999:999)
    REDIS_UID=$(docker run --rm redis:6.2 id -u redis)
    REDIS_GID=$(docker run --rm redis:6.2 id -g redis)
    
    # 按容器用户身份授权目录
    sudo chown -R ${REDIS_UID}:${REDIS_GID} /docker/redis
    sudo chmod -R 755 /docker/redis  # 避免 777 的安全风险
    
    docker run -d --name redis -p 6379:6379 -v /docker/redis/conf/redis.conf:/etc/redis/redis.conf -v /docker/redis/data:/data -v /docker/redis/logs:/logs --restart=unless-stopped --memory="512m" --cpus="1" redis:6.2 redis-server /etc/redis/redis.conf --user "${REDIS_UID}:${REDIS_GID}"   
    
  • docker安装zipkin

    docker pull openzipkin/zipkin
    docker run -d --restart always -p 9411:9411 --name zipkin openzipkin/zipkin
    
  • docker安装sentinel

    docker pull bladex/sentinel-dashboard:1.7.1
    docker run --name sentinel -d  -p 8858:8858  bladex/sentinel-dashboard:1.7.1
    
  • docker安装mysql

    docker run -d --name mysql-dev -p 3306:3306 -e MYSQL_ROOT_PASSWORD=lzc911823616 -v /docker/mysql/data:/var/lib/mysql -v /docker/mysql/conf:/etc/mysql/conf.d -v /docker/mysql/log:/var/log/mysql --restart=unless-stopped --memory="2g" --cpus="1" mysql:8.0
    
  • docker安装SQLserver

    点击跳转

    点击跳转

    如果跑不起来,把密码设置复杂点,不行再查日志看原因

  • 原生安装SQLserver

    点击跳转

Loading...