百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术文章 > 正文

「Docker自学笔记」Docker常用命令&用法

nanshan 2024-11-04 13:04 10 浏览 0 评论

安装(Ubuntu)使用(常用命令)容器数据卷创建自定义镜像DockerFile容器内自定义镜像源自定义网络保存镜像导入镜像推送镜像到hub Docker常用命令

Docker常用命令

  • 官方下载安装
  • 官方文档
  • Docker仓库搜索

安装(Ubuntu)

  • 更多内容请查考官方文档
  • 依次执行下列代码即可!
#卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc

#使用 Docker 仓库进行安装
#更新 apt 包索引
sudo apt-get update

#安装 apt 依赖包,用于通过HTTPS来获取仓库
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release \
    software-properties-common
    
#添加Docker官方的GPG密钥(使用镜像)
 curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
 
#设置稳定版仓库
sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
  stable"
  
#安装 Docker 引擎
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
  • 测试是否安装成功
sudo docker run hello-world

xiaoqiang@xiaoqiangclub:~/桌面nbsp;sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Already exists 
Digest: sha256:9f6ad537c5132bcce57f7a0a20e317228d382c3cd61edae14650eec68b2b345c
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 nbsp;docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

  • 更多内容请查考官方文档

使用(常用命令)

  • 下面是一些常用命令
#万能的帮助命令
docker 命令 --help   #docker images --help

#搜索镜像
docker search 镜像  #docker search ubuntu

#拉取镜像
docker pull 镜像:版本 #docker pull ubuntu:18.04

#查看本地所有镜像
docker images
docker images -aq  #显示所有镜像的id 

#删除镜像
docker rmi -f 镜像名/id  #-f强制删除镜像
docker rmi -f $(docker images -aq)  #删除所有镜像

#启动容器,可以使用 镜像名:版本号 启动,如果是最新版可以省略版本号;也可以使用 镜像id
docker run -i -t 镜像名:版本号 /bin/bash  
docker run -i -t id /bin/bash
docker run -it --rm id /bin/bash  #添加 --rm参数 可以实现在退出容器后就删除容器(一般用于测试)
参数说明:
-i: 交互式操作。
-t: 终端。
ubuntu: ubuntu 镜像。
/bin/bash:放在镜像名后的是命令,这里我们希望有个交互式 Shell,因此用的是 /bin/bash。
要退出终端,直接输入 exit 这个命令会停止容器!可以使用 ctrl + p + q 组合键退出,不会退出容器

#退出容器
exit      #这个命令会停止容器!
ctrl + p + q    #组合键退出,不会退出容器

#查看当前运行的容器
docker ps
docker ps -a     #显示所有容器
#启动一个已停止的容器
docker start 容器id #通过docker ps -a可以查看
#重启一个容器
docker restart 容器id 
#停止容器
docker stop 容器id
docker kill 容器id   #当使用 stop 无法正常停止的时候使用 kill

#后台运行容器:-d 后台运行 --name 设定容器的别名
docker run -i -t -d -p 外网端口:容器端口 --name 容器别名 镜像 /bin/bash  #docker run -i -t -d -p 6666:80 --name ubuntu-test ubuntu /bin/bash

#在使用 -d 参数时,容器启动后会进入后台,此时想要进入容器,可以通过以下指令进入
docker attach 容器id  #重新进入容器当前正在运行的命令终端,使用exit会停止容器!
docker exec -i -t 容器id /bin/bash #进入容器并开启一个新的终端,使用exit不会停止容器(常用)

#删除容器
docker rm -f 容器别名/容器id  #docker rm -f test_ubuntu

#拷贝容器文件到宿主机(复制文件)
docker cp 容器id/容器id:容器内文件路径 要拷贝到的路径  #docker cp test-ubuntu:/home/test.txt /home

#查看容器的cpu内存状态
docker stats

# 从容器创建一个新的镜像
docker commit -a 作者 -m 说明信息 容器id 容器名称:版本号 #docker commit -a "xiaoqiangclub" -m "this is a test!" a404c6c174a2  mymysql:v1 
OPTIONS说明:

-a :提交镜像的作者;

-c :使用Dockerfile指令来创建镜像;

-m :提交时的说明文字;

-p :在commit时,将容器暂停。
  • docker run -it --rm id /bin/bash 添加参数 --rm 可以实现在退出容器后就删除容器(一般用于测试)
  • 直接输入exit 这个命令会停止容器!可以使用ctrl + p + q 组合键退出,不会退出容器
  • 我们常用docker exec -i -t 容器id /bin/bash命令进入容器并开启一个新的终端,这个命令进入容器后使用exit不会停止容器
  • 后台启动容器使用docker run -i -t -d --name ubuntu-test ubuntu /bin/bash
  • 复制文件命令docker cp test-ubuntu:/home/test.txt /home
  • docker run -m设置容器使用内存最大值

容器数据卷

为了容器内数据的持久化&与宿主机的数据同步,我们可以使用容器的数据卷。

  • 添加-v参数来映射目录,命令docker run -it -v 主机目录:容器目录 镜像 /bin/bash
  • 具名挂载:- 添加-v参数来映射目录,命令docker run -it -v 卷名:主机目录:容器目录 镜像 /bin/bash;使用docker volume ls查看卷
docker 容器内路径    # 匿名挂载
docker 卷名:容器内路径   # 具名挂载
docker /宿主机路径:容器内路径 # 指定路径挂载
docker 卷名:容器内路径:ro/rw  # 使用ro/rw来设置读写权限:ro:readonly;rw:readwrite;默认为:rw;如果设置为ro:说明这个路径只能通过宿主机改变,容器内无法改变!
  • docker inspect获取容器/镜像的元数据(详情)

创建自定义镜像

  • 使用Docker commit 命令从容器创建一个新的镜像,下面是他的用法
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker commit --help

Usage:  docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] # 用法

Create a new image from a container's changes

Options:
  -a, --author string    作者(e.g., "John Hannibal Smith <hannibal@a-team.com>")
  -c, --change list      使用Dockerfile指令来创建镜像
  -m, --message string   提交时的说明文字
  -p, --pause            在commit时,将容器暂停 (默认:true)
  • 我们运行容器并且在容器中安装了ipython,现在使用commit来创建一个行的镜像
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker commit -m 'add ipython' -a 'xiaoqiangclub<xiaoqiangclub@hotmail.com>' image-test image-commit-test
sha256:b6819ae4531e548c7ff400017d302da82601f931eed7c1edf765465556601d64
  • docker images查看镜像
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker images
REPOSITORY          TAG       IMAGE ID       CREATED         SIZE
image-commit-test   latest    b6819ae4531e   2 minutes ago   234MB  # 这个就是我们安装ipython后新创建的镜像
my-ubuntu           latest    beb3e79259ee   10 hours ago    134MB

DockerFile

Dockerfile就是用来构建docker镜像的构建文件

  • DockerFile常用命令
FROM    # 基础镜像
MAINTAINER   # 作者,姓名 + 邮箱
RUN     # 镜像构建的时候需要运行的命令
ADD     # 添加内容(COPY文件,会自动解压)
WORKDIR    # 设置工作目录(相当于cd)
VOLUME    # 目录挂载
EXPOST    # 暴露端口
CMD     # 指定容器启动的时候需要运行的命令,只有最后一个会生效,可被替代!
ENTRYPOINT   # 指定容器启动的时候需要运行的命令,可以追加命令
ONBUILD    # 当构建一个被继承时,DockerFile 就会运行 ONBUILD 的指令,是一个触发指令。
COPY    # 类似ADD,将文件拷贝到镜像中
ENV     # 构建的时候设置环境变量

DockerFile常用命令

容器内自定义镜像源

  • 简单示例
xiaoqiang@xiaoqiangclub:~/桌面/docker-study/DockerFilenbsp;vim myDockFile-ubuntu
xiaoqiang@xiaoqiangclub:~/桌面/docker-study/DockerFilenbsp;cat myDockFile-ubuntu 
FROM ubuntu
MAINTAINER xiaoqiangclub<xiaoqiangclub@hotmail.com>

ENV MYPATH /usr/local
WORKDIR $MYPATH

# 设置镜像源
COPY sources.list /etc/apt/sources.list  
# 使用&&连接构建为一层,最后清理缓存
RUN apt update \
&&apt-get install -y vim net-tools \
&& rm -rf /var/lib/apt/lists/*

EXPOSE 80

CMD echo $MYPATH
CMD ECHO "----end----"
CMD /bin/bash
  • 报错解决方案
  • sources.list文件
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 使用docker history 容器id/容器名:版本可以查看容器的构建过程
  • 容器内更换镜像源后使用apt update可能会提示以下错误(NO_PUBKEY缺少公钥):
  • 依次运行gpg --keyserver keyserver.ubuntu.com --recv 公钥gpg --export --armor 公钥 | apt-key add -即可(非docker容器中运行的话需要添加sudo
root@eee3e5c095f6:/# gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32 # 报错的时候提供的公钥
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 3B4FE6ACC0B21F32: public key "Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
root@eee3e5c095f6:/# gpg --export --armor 3B4FE6ACC0B21F32 | apt-key add -
OK
  • 现在在运行apt update就正常了!
  • 使用build生成镜像,先看看参数说明
xiaoqiang@xiaoqiangclub:~/桌面/myProjects/myDockerFilenbsp;docker build --help

Usage:  docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --cgroup-parent string    Optional parent cgroup for the container
      --compress                Compress the build context using gzip
      --cpu-period int          Limit the CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int           Limit the CPU CFS (Completely Fair Scheduler) quota
  -c, --cpu-shares int          CPU shares (relative weight)
      --cpuset-cpus string      CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string      MEMs in which to allow execution (0-3, 0,1)
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --force-rm                Always remove intermediate containers
      --iidfile string          Write the image ID to the file
      --isolation string        Container isolation technology
      --label list              Set metadata for an image
  -m, --memory bytes            Memory limit
      --memory-swap bytes       Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --network string          Set the networking mode for the RUN instructions during build (default "default")
      --no-cache                Do not use cache when building the image
      --pull                    Always attempt to pull a newer version of the image
  -q, --quiet                   Suppress the build output and print image ID on success
      --rm                      Remove intermediate containers after a successful build (default true)
      --security-opt strings    Security options
      --shm-size bytes          Size of /dev/shm
  -t, --tag list                Name and optionally a tag in the 'name:tag' format
      --target string           Set the target build stage to build.
      --ulimit ulimit           Ulimit options (default [])
  • 如果你的文件名为Dockerfile,可以直接使用docker build -t 镜像名:版本号 .(注意最后有一个点,如果是其他文件名,请使用-f参数指定文件路径)

自定义网络

  • 我们可以使用docker network自定义网络,使用说明
Usage:  docker network COMMAND

Manage networks

Commands:
  connect     # 将一个容器连接到网络
  create      # 创建一个自定义网络
  disconnect  # 将一个容器从自定义网络断开
  inspect     # 显示自定义网络的详细信息
  ls          # 列出所有网络
  prune       # 删除所有未使用的网络
  rm          # 删除一个或多个网络
  • 下面是docker默认的网络
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network ls
NETWORK ID     NAME                DRIVER    SCOPE
b3c47254c1ce   bridge              bridge    local
205f46f5b907   host                host      local
8d0210334194   none                null      local
  • 我们可以使用--net 网络的方式指定容器使用的网络,如docker run -it --net host my-ubuntu
  • 有时候在docker中使用Ubuntu镜像无法联网,我们可以尝试使用命令docker run -it --net host ubuntu即可解决!(有些情况下重启一下主机就解决了!)
  • 自己创建一个docker network create参数
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network create --help

Usage:  docker network create [OPTIONS] NETWORK

Create a network

Options:
      --attachable           Enable manual container attachment
      --aux-address map      Auxiliary IPv4 or IPv6 addresses used by Network driver (default map[])
      --config-from string   The network from which to copy the configuration
      --config-only          Create a configuration only network
  -d, --driver string        创建一个网络,默认:bridge
      --gateway strings      网关
      --ingress              Create swarm routing-mesh network
      --internal             Restrict external access to the network
      --ip-range strings     Allocate container ip from a sub-range
      --ipam-driver string   IP Address Management Driver (default "default")
      --ipam-opt map         Set IPAM driver specific options (default map[])
      --ipv6                 Enable IPv6 networking
      --label list           Set metadata on a network
  -o, --opt map              Set driver specific options (default map[])
      --scope string         Control the network's scope
      --subnet strings       子网掩码
  • --drive类型
bridge:多由于独立container之间的通信
host: 直接使用宿主机的网络,端口也使用宿主机的
overlay:当有多个docker主机时,跨主机的container通信
macvlan:每个container都有一个虚拟的MAC地址
none: 禁用网络
  • 根据上面的使用说明,我们可以尝试使用命令docker network create --driver bridge --subnet 192.168.0.0/16 --gateway 192.168.0.1 mynet来创建一个网络(也可以直接简写docker network create test-net):
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network create --driver bridge --subnet 192.168.0.0/16 --gateway 192.168.0.1 mynet
856ac8b90e9b76be642751446de170d6400b9a9c96f896f1ee71de8db7f4d8f0
  • 现在查看一下docker下的网络docker network ls
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network ls
NETWORK ID     NAME                DRIVER    SCOPE
2087a9b3522d   bridge              bridge    local
205f46f5b907   host                host      local
856ac8b90e9b   mynet               bridge    local  # 这就是我们刚创建的网络
8d0210334194   none                null      local
9cad2d367255   proxypool_default   bridge    local
  • 现在我们就可以使用刚刚创建的网络运行容器试试了!
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker run -it --net=mynet my-ubuntu
root@59052c9eca94:/usr/local# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.2  netmask 255.255.0.0  broadcast 192.168.255.255 # 使用了我们刚创建的网络
        ether 02:42:c0:a8:00:02  txqueuelen 0  (Ethernet)
        RX packets 23  bytes 4216 (4.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • 可以添加--ip指定容器的ip(在网卡的网段内),例如:docker run -it --net mynet --ip 192.168.0.66 my-ubuntu

保存镜像

  • 使用docker save将指定镜像保存成 tar 归档文件,来看一下它的参数
xiaoqiang@xiaoqiangclub:~/桌面nbsp;docker save --help

Usage:  docker save [OPTIONS] IMAGE [IMAGE...]

Save one or more images to a tar archive (streamed to STDOUT by default)

Options:
  -o, --output string   输入文件
  • 例如docker save -o /home/xiaoqiang/桌面/myProjects/my-django-web-image.tar xiaoqiangclub/django-web:v1.0

导入镜像

  • 使用docker load 导入docker save 命令导出的镜像,参数
xiaoqiang@xiaoqiangclub:~/桌面nbsp;docker load --help

Usage:  docker load [OPTIONS]

Load an image from a tar archive or STDIN

Options:
  -i, --input string   # 指定导入的文件,代替 STDIN
  -q, --quiet          # 精简输出信息
  • 例如docker load --input my-django-web-image.tar,也可以docker load < my-django-web-image.tar

推送镜像到hub

  • docker login docker logout登入登出
  • 参考文章
  • 阿里云复制下来的操作指南

1. 登录阿里云Docker Registry
$ docker login --username=xiaoqiang**** registry.cn-hangzhou.aliyuncs.com
用于登录的用户名为阿里云账号全名,密码为开通服务时设置的密码。

您可以在访问凭证页面修改凭证密码。

2. 从Registry中拉取镜像
$ docker pull registry.cn-hangzhou.aliyuncs.com/xiaoqiangclub/xiaoqiangclub:[镜像版本号]
3. 将镜像推送到Registry
$ docker login --username=xiaoqiang**** registry.cn-hangzhou.aliyuncs.com
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/xiaoqiangclub/xiaoqiangclub:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/xiaoqiangclub/xiaoqiangclub:[镜像版本号]
请根据实际镜像信息替换示例中的[ImageId]和[镜像版本号]参数。

4. 选择合适的镜像仓库地址
从ECS推送镜像时,可以选择使用镜像仓库内网地址。推送速度将得到提升并且将不会损耗您的公网流量。

如果您使用的机器位于VPC网络,请使用 registry-vpc.cn-hangzhou.aliyuncs.com 作为Registry的域名登录。

5. 示例
使用"docker tag"命令重命名镜像,并将它通过专有网络地址推送至Registry。

$
docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
registry.aliyuncs.com/acs/agent 0.7-dfb6816 37bb9c63c8b2 7 days ago 37.89 MB
$ docker tag 37bb9c63c8b2 registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816
使用 "docker push" 命令将该镜像推送至远程。

$
docker push registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816

相关推荐

实战派 | Java项目中玩转Redis6.0客户端缓存

铺垫首先介绍一下今天要使用到的工具Lettuce,它是一个可伸缩线程安全的redis客户端。多个线程可以共享同一个RedisConnection,利用nio框架Netty来高效地管理多个连接。放眼望向...

轻松掌握redis缓存穿透、击穿、雪崩问题解决方案(20230529版)

1、缓存穿透所谓缓存穿透就是非法传输了一个在数据库中不存在的条件,导致查询redis和数据库中都没有,并且有大量的请求进来,就会导致对数据库产生压力,解决这一问题的方法如下:1、使用空缓存解决对查询到...

Redis与本地缓存联手:多级缓存架构的奥秘

多级缓存(如Redis+本地缓存)是一种在系统架构中广泛应用的提高系统性能和响应速度的技术手段,它综合利用了不同类型缓存的优势,以下为你详细介绍:基本概念本地缓存:指的是在应用程序所在的服务器内...

腾讯云国际站:腾讯云服务器如何配置Redis缓存?

本文由【云老大】TG@yunlaoda360撰写一、安装Redis使用包管理器安装(推荐)在CentOS系统中,可以通过yum包管理器安装Redis:sudoyumupdate-...

Spring Boot3 整合 Redis 实现数据缓存,你做对了吗?

你是否在开发互联网大厂后端项目时,遇到过系统响应速度慢的问题?当高并发请求涌入,数据库压力剧增,响应时间拉长,用户体验直线下降。相信不少后端开发同行都被这个问题困扰过。其实,通过在SpringBo...

【Redis】Redis应用问题-缓存穿透缓存击穿、缓存雪崩及解决方案

在我们使用redis时,也会存在一些问题,导致请求直接打到数据库上,导致数据库挂掉。下面我们来说说这些问题及解决方案。1、缓存穿透1.1场景一个请求进来后,先去redis进行查找,redis存在,则...

Spring boot 整合Redis缓存你了解多少

在前一篇里面讲到了Redis缓存击穿、缓存穿透、缓存雪崩这三者区别,接下来我们讲解Springboot整合Redis中的一些知识点:之前遇到过,有的了四五年,甚至更长时间的后端Java开发,并且...

揭秘!Redis 缓存与数据库一致性问题的终极解决方案

在现代软件开发中,Redis作为一款高性能的缓存数据库,被广泛应用于提升系统的响应速度和吞吐量。然而,缓存与数据库之间的数据一致性问题,一直是开发者们面临的一大挑战。本文将深入探讨Redis缓存...

高并发下Spring Cache缓存穿透?我用Caffeine+Redis破局

一、什么是缓存穿透?缓存穿透是指查询一个根本不存在的数据,导致请求直接穿透缓存层到达数据库,可能压垮数据库的现象。在高并发场景下,这尤其危险。典型场景:恶意攻击:故意查询不存在的ID(如负数或超大数值...

Redis缓存三剑客:穿透、雪崩、击穿—手把手教你解决

缓存穿透菜小弟:我先问问什么是缓存穿透?我听说是缓存查不到,直接去查数据库了。表哥:没错。缓存穿透是指查询一个缓存中不存在且数据库中也不存在的数据,导致每次请求都直接访问数据库的行为。这种行为会让缓存...

Redis中缓存穿透问题与解决方法

缓存穿透问题概述在Redis作为缓存使用时,缓存穿透是常见问题。正常查询流程是先从Redis缓存获取数据,若有则直接使用;若没有则去数据库查询,查到后存入缓存。但当请求的数据在缓存和数据库中都...

Redis客户端缓存的几种实现方式

前言:Redis作为当今最流行的内存数据库和缓存系统,被广泛应用于各类应用场景。然而,即使Redis本身性能卓越,在高并发场景下,应用于Redis服务器之间的网络通信仍可能成为性能瓶颈。所以客户端缓存...

Nginx合集-常用功能指导

1)启动、重启以及停止nginx进入sbin目录之后,输入以下命令#启动nginx./nginx#指定配置文件启动nginx./nginx-c/usr/local/nginx/conf/n...

腾讯云国际站:腾讯云怎么提升服务器速度?

本文由【云老大】TG@yunlaoda360撰写升级服务器规格选择更高性能的CPU、内存和带宽,以提供更好的处理能力和网络性能。优化网络配置调整网络接口卡(NIC)驱动,优化TCP/IP参数...

雷霆一击服务器管理员教程

本文转载莱卡云游戏服务器雷霆一击管理员教程(搜索莱卡云面版可搜到)首先你需要给服务器设置管理员密码,默认是空的管理员密码在启动页面进行设置设置完成后你需要重启服务器才可生效加入游戏后,点击键盘左上角E...

取消回复欢迎 发表评论: