热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Kubernetes实战教学,手把手教您用2个脚本在PWK上启用Compose...

出品丨Docker公司(ID:docker-cn)编译丨小东每周一、三、五,与您不见不散!在Dockercon的第二天,Docker在Kubernetes项目上开源了Compose

Kubernetes 实战教学,手把手教您用2个脚本在 PWK 上启用 Compose
...

出品丨Docker公司(ID:docker-cn)
编译丨小东
每周一、三、五,与您不见不散!


在 Dockercon 的第二天,Docker 在 Kubernetes 项目上开源了 Compose。这个工具无疑可以简化 Kubernetes。如果您不知道,Docker 企业版已经在 Compose File 3.3 版本中启用了这个功能,它可以让您使用相同的 docker-compose.yml 文件进行 Swarm 部署,也可以在部署应用栈时指定 Kubernetes 工作负载。


Kubernetes 实战教学,手把手教您用2个脚本在 PWK 上启用 Compose
...

两周前,我注意到社区中有人要求在 Kubernetes Playground 上运行 Compose on Kubernetes。出于我的兴趣,我开始研究如何简化解决方案,以便任何人都能在短时间内轻松地设置它。我创建了镜像仓库,并开始构建一个简单的脚本和 Makefile 来启动它并在 PWK 上运行。点击下列文章标题,查看详情:

  • Kubernetes 实战教学,手把手教您如何在 K8s 平台上使用 Compose(一);
  • Kubernetes 实战教学,手把手教您如何在 K8s 平台上使用 Compose(二);

在这篇博文中,我将向您演示如何使用2个脚本就可以在 Play with Kubernetes 平台上启用 Compose on Kubernetes。接下来,让我们开始吧!


首先,浏览 https://labs.play-with-k8s.com/ 访问Kubernetes Playground。

Kubernetes 实战教学,手把手教您用2个脚本在 PWK 上启用 Compose
...

单击“Login”按钮,并使用 Docker Hub 或 GitHub ID 进行身份验证。

Kubernetes 实战教学,手把手教您用2个脚本在 PWK 上启用 Compose
...

一旦开始会话,您将拥有一个自己的实验室环境。


添加第一个 Kubernetes 节点

单击左侧的“Add New Instance” 来建您的第一个 Kubernetes 集群节点。它会自动将其命名为“node1”。每个实例都预装了Docker Community Edition(CE)和Kubeadm。该节点将被视为我们群集的主节点。

Kubernetes 实战教学,手把手教您用2个脚本在 PWK 上启用 Compose
...


引导主节点

克隆镜像仓库并在第一个实例上运行此脚本:

git clone https://github.com/collabnix/compose-on-kubernetes
cd compose-on-kubernetes/scripts/pwk/
sh bootstrap-pwk.sh

当您执行此脚本时,作为初始化的一部分,kubeadm 会编写所需的几个配置文件,设置 RBAC 并部署 Kubernetes 控制平面组件(如 kube-apiserver、kube-dns、kube-proxy 和 etcd 等)。控制平面组件部署为 Docker 容器。

Kubernetes 实战教学,手把手教您用2个脚本在 PWK 上启用 Compose
...

复制上面的 kubeadm 连接令牌命令并将其保存,以供下一步使用。此命令将用于将其他节点加入群集。


添加工作节点

Kubernetes 实战教学,手把手教您用2个脚本在 PWK 上启用 Compose
...

点击“Add New Node”来添加一个新的工作节点。


检查集群状态

[node1 ~]$ kubectl get nodes
NAME     STATUS    ROLES    AGE      VERSION
node1    Ready     master   18m      v1.11.3
node2    Ready        4m       v1.11.3
node3    Ready        39s      v1.11.3
node4    NotReady     22s      v1.11.3
node5    NotReady     4s       v1.11.3
[node1 ]$ kubectl get po
No resources found.
[node1 ]$ kubectl get svc
NAME        TYPE       CLUSTER-IP  EXTERNAL-IP  PORT(S)  AGE
kubernetes  ClusterIP  10.96.0.1          443/TCP  1h

执行以下脚本,一次性设置好 Compose Namespace、etcd cluster 和 Compose controller:

chmod +x prepare-pwk.sh
sh prepare-pwk.sh
[node1 pwk]$ sh prepare-pwk.sh
Creating Compose Namespace...
namespace/compose created
Installing Helm...
 % Total   % Received % Xferd Average Speed  Time   Time    Time Current
                                Dload Upload  Total  Spent   Left Speed
100 21.6M 100 21.6M   0    0 25.3M     0 --:--:-- --:--:-- --:--:-- 25.4M
Preparing Helm
linux-amd64/
linux-amd64/tiller
linux-amd64/helm
linux-amd64/LICENSE
linux-amd64/README.md
Creating tiller under kube-system namespace...
serviceaccount/tiller created
clusterrolebinding.rbac.authorization.k8s.io/tiller-cluster-rule created
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.
 
Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
 
Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!
 Tiller is still coming up...Please Wait
NAME                            READY    STATUS   RESTARTS  AGE
coredns-78fcdf6894-699fx        1/1      Running  0         5m
coredns-78fcdf6894-trslx        1/1      Running  0         5m
etcd-node1                      1/1      Running  0         4m
kube-apiserver-node1            1/1      Running  0         4m
kube-controller-manager-node1   1/1      Running  0         4m
kube-proxy-5gskp                1/1      Running  0         4m
kube-proxy-5hbkb                1/1      Running  0         5m
kube-proxy-lcsnz                1/1      Running  0         4m
kube-scheduler-node1            1/1      Running  0         4m
tiller-deploy-85744d9bfb-bjw2f  0/1      Running  0         15s
weave-net-9vt2s                 2/2      Running  1         4m
weave-net-k87d7                 2/2      Running  0         5m
weave-net-nmmt5                 2/2      Running  0         4m
NAME:  etcd-operator
LAST DEPLOYED: Mon Jan 21 14:27:50 2019
NAMESPACE: compose
STATUS: DEPLOYED
 
RESOURCES:
==> v1/ServiceAccount
NAME                                              SECRETS AGE
etcd-operator-etcd-operator-etcd-backup-operator  1       4s
etcd-operator-etcd-operator-etcd-operator         1       4s
etcd-operator-etcd-operator-etcd-restore-operator 1       4s
 
==> v1beta1/ClusterRole
NAME                                      AGE
etcd-operator-etcd-operator-etcd-operator 4s
 
==> v1beta1/ClusterRoleBinding
NAME                                              AGE
etcd-operator-etcd-operator-etcd-backup-operator  4s
etcd-operator-etcd-operator-etcd-operator         3s
etcd-operator-etcd-operator-etcd-restore-operator 3s
 
==> v1/Service
NAME                  TYPE      CLUSTER-IP   EXTERNAL-IP PORT(S)   AGE
etcd-restore-operator ClusterIP 10.108.89.92       19999/TCP 3s
 
==> v1beta2/Deployment
NAME                                              DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
etcd-operator-etcd-operator-etcd-backup-operator  1       1       1          0         3s
etcd-operator-etcd-operator-etcd-operator         1       1       1          0         3s
etcd-operator-etcd-operator-etcd-restore-operator 1       1       1          0         3s
 
==> v1/Pod(related)
NAME                                                            READY STATUS            RESTARTS AGE
etcd-operator-etcd-operator-etcd-backup-operator-56fd448cd897mk 0/1   ContainerCreating 0     2s
etcd-operator-etcd-operator-etcd-operator-c5b8b8f74-pttr2       0/1   ContainerCreating 0     2s
etcd-operator-etcd-operator-etcd-restore-operator-58587cdc9g4br 0/1   ContainerCreating 0     2s
 
 
NOTES:
1. etcd-operator deployed.
 If you would like to deploy an etcd-cluster set cluster.enabled to true in values.yaml
 Check the etcd-operator logs
   export POD=$(kubectl get pods -l app=etcd-operator-etcd-operator-etcd-operator --namespacecompose --output name)
   kubectl logs $POD --namespace=compose
Loaded plugins: fastestmirror, ovl
base                                                                   | 3.6 kB 00:00:00
docker-ce-stable                                                       | 3.5 kB 00:00:00
extras                                                                 | 3.4 kB 00:00:00
kubernetes/signature                                                   | 454 B 00:00:00
kubernetes/signature                                                   | 1.4 kB 00:00:10 !!!
updates                                                                | 3.4 kB 00:00:00
(1/7): base/7/x86_64/group_gz                                          | 166 kB 00:00:00
(2/7): extras/7/x86_64/primary_db                                      | 156 kB 00:00:00
(3/7): base/7/x86_64/primary_db                                        | 6.0 MB 00:00:00
(4/7): updates/7/x86_64/primary_db                                     | 1.3 MB 00:00:00
(5/7): docker-ce-stable/x86_64/primary_db                              | 20 kB 00:00:00
(6/7): docker-ce-stable/x86_64/updateinfo                              |  55 B 00:00:01
(7/7): kubernetes/primary                                              | 42 kB 00:00:01
Determining fastest mirrors
 * base: mirror.nl.datapacket.com
 * extras: mirror.nl.datapacket.com
 * updates: mirror.denit.net
kubernetes                                                                            305/305
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
===============================================================================================
 Package           Arch                Version                     Repository         Size
===============================================================================================
Installing:
 wget              x86_64              1.14-18.el7                 base              547 k
 
Transaction Summary
===============================================================================================
Install 1 Package
 
Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7.x86_64.rpm                                            | 547 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : wget-1.14-18.el7.x86_64                                                    1/1
install-info: No such file or directory for /usr/share/info/wget.info.gz
 Verifying : wget-1.14-18.el7.x86_64                                                    1/1
 
Installed:
 wget.x86_64 0:1.14-18.el7
 
Complete!
$HELM_HOME has been configured at /root/.helm.
 
Tiller (the Helm server-side component) has been upgraded to the current version.
Happy Helming!
etcdcluster.etcd.database.coreos.com/compose-etcd created
NAME                            READY    STATUS   RESTARTS  AGE
coredns-78fcdf6894-699fx        1/1      Running  0         6m
coredns-78fcdf6894-trslx        1/1      Running  0         6m
etcd-node1                      1/1      Running  0         5m
kube-apiserver-node1            1/1      Running  0         6m
kube-controller-manager-node1   1/1      Running  0         5m
kube-proxy-5gskp                1/1      Running  0         6m
kube-proxy-5hbkb                1/1      Running  0         6m
kube-proxy-lcsnz                1/1      Running  0         5m
kube-scheduler-node1            1/1      Running  0         5m
tiller-deploy-85744d9bfb-bjw2f  1/1      Running  0         1m
weave-net-9vt2s                 2/2      Running  1         6m
weave-net-k87d7                 2/2      Running  0         6m
weave-net-nmmt5                 2/2      Running  0         5m
--2019-01-21 14:28:49-- https://github.com/docker/compose-on-kubernetes/releases/download/v0.4.18/installer-linux
Resolving github.com (github.com)... 140.82.118.3, 140.82.118.4
Connecting to github.com (github.com)|140.82.118.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/158560458/e9a86500-15b2-11e9-8620-1eec5bf160e3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190121T142850Z&X-Amz-Expires=300&X-Amz-Signature=bd4020beb0f68210e2a3cfa8ca8166dddcf1d1e4868737eb9ad83363cd39c660&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dinstaller-linux&response-content-type=application%2Foctet-stream [following]
--2019-01-21 14:28:50-- https://github-production-release-asset-2e65be.s3.amazonaws.com/158560458/e9a86500-15b2-11e9-8620-1eec5bf160e3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190121T142850Z&X-Amz-Expires=300&X-Amz-Signature=bd4020beb0f68210e2a3cfa8ca8166dddcf1d1e4868737eb9ad83363cd39c660&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dinstaller-linux&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.161.163
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.161.163|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 28376064 (27M) [application/octet-stream]
Saving to: 'installer-linux'
 
100%[=====================================================>] 28,376,064 15.9MB/s  in 1.7s
 
2019-01-21 14:28:52 (15.9 MB/s) - 'installer-linux' saved [28376064/28376064]
 
INFO[0000] Checking installation state
INFO[0000] Install image with tag "v0.4.18" in namespace "compose"
INFO[0000] Api server: image: "docker/kube-compose-api-server:v0.4.18", pullPolicy: "Always"
INFO[0001] Controller: image: "docker/kube-compose-controller:v0.4.18", pullPolicy: "Always"
failed to find a Stack API version
error: the server doesn't have a resource type "stacks"
[node1 pwk]$ sh prepare-pwk.sh
Creating Compose Namespace...
Installing Helm...
 % Total   % Received % Xferd Average Speed  Time   Time    Time Current
                                Dload Upload  Total  Spent   Left Speed
100 21.6M 100 21.6M   0    0 14.9M     0 0:00:01 0:00:01 --:--:-- 14.9M
Preparing Helm
linux-amd64/
linux-amd64/tiller
linux-amd64/helm
linux-amd64/LICENSE
linux-amd64/README.md
Creating tiller under kube-system namespace...
clusterrolebindings.rbac.authorization.k8s.io "tiller-cluster-rule" already exists
$HELM_HOME has been configured at /root/.helm.
 
Tiller (the Helm server-side component) has been upgraded to the current version.
Happy Helming!
 Tiller is still coming up...Please Wait
NAME                            READY    STATUS   RESTARTS  AGE
coredns-78fcdf6894-699fx        1/1      Running  0         7m
coredns-78fcdf6894-trslx        1/1      Running  0         7m
etcd-node1                      1/1      Running  0         6m
kube-apiserver-node1            1/1      Running  0         6m
kube-controller-manager-node1   1/1      Running  0         6m
kube-proxy-5gskp                1/1      Running  0         6m
kube-proxy-5hbkb                1/1      Running  0         7m
kube-proxy-lcsnz                1/1      Running  0         6m
kube-scheduler-node1            1/1      Running  0         6m
tiller-deploy-85744d9bfb-bjw2f  1/1      Running  0         2m
weave-net-9vt2s                 2/2      Running  1         6m
weave-net-k87d7                 2/2      Running  0         7m
weave-net-nmmt5                 2/2      Running  0         6m
NAME           REVISION       UPDATED                        STATUS         CHART       APP VERSION    NAMESPACE
etcd-operator  1              Mon Jan 21 14:27:50 2019       DEPLOYED       etcd-operator-0.8.3   0.9.3          compose
Run: helm ls --all etcd-operator; to check the status of the release
Or run: helm del --purge etcd-operator; to delete it
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.nl.datapacket.com
 * extras: mirror.nl.datapacket.com
 * updates: mirror.denit.net
Package wget-1.14-18.el7.x86_64 already installed and latest version
Nothing to do
$HELM_HOME has been configured at /root/.helm.
 
Tiller (the Helm server-side component) has been upgraded to the current version.
Happy Helming!
etcdcluster.etcd.database.coreos.com/compose-etcd unchanged
NAME                            READY    STATUS   RESTARTS  AGE
coredns-78fcdf6894-699fx        1/1      Running  0         7m
coredns-78fcdf6894-trslx        1/1      Running  0         7m
etcd-node1                      1/1      Running  0         6m
kube-apiserver-node1            1/1      Running  0         7m
kube-controller-manager-node1   1/1      Running  0         7m
kube-proxy-5gskp                1/1      Running  0         7m
kube-proxy-5hbkb                1/1      Running  0         7m
kube-proxy-lcsnz                1/1      Running  0         6m
kube-scheduler-node1            1/1      Running  0         6m
tiller-deploy-85744d9bfb-bjw2f  1/1      Running  0         2m
weave-net-9vt2s                 2/2      Running  1         7m
weave-net-k87d7                 2/2      Running  0         7m
weave-net-nmmt5                 2/2      Running  0         6m
--2019-01-21 14:30:05-- https://github.com/docker/compose-on-kubernetes/releases/download/v0.4.18/installer-linux
Resolving github.com (github.com)... 140.82.118.3, 140.82.118.4
Connecting to github.com (github.com)|140.82.118.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/158560458/e9a86500-15b2-11e9-8620-1eec5bf160e3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190121T143006Z&X-Amz-Expires=300&X-Amz-Signature=53d5f390f91b968a53219512c18b696e1a085cbbd59cdb953ca95bea1aca4d60&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dinstaller-linux&response-content-type=application%2Foctet-stream [following]
--2019-01-21 14:30:06-- https://github-production-release-asset-2e65be.s3.amazonaws.com/158560458/e9a86500-15b2-11e9-8620-1eec5bf160e3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190121T143006Z&X-Amz-Expires=300&X-Amz-Signature=53d5f390f91b968a53219512c18b696e1a085cbbd59cdb953ca95bea1aca4d60&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dinstaller-linux&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.233.59
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.233.59|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 28376064 (27M) [application/octet-stream]
Saving to: 'installer-linux.1'
 
100%[=====================================================>] 28,376,064 16.3MB/s  in 1.7s
 
2019-01-21 14:30:08 (16.3 MB/s) - 'installer-linux.1' saved [28376064/28376064]
 
INFO[0000] Checking installation state
INFO[0001] Compose version v0.4.18 is already installed in namespace "compose" with the same settings
compose.docker.com/v1beta1
compose.docker.com/v1beta2
Waiting for the stack to be stable and running...
db1: Pending           [pod status: 0/2 ready, 2/2 pending, 0/2 failed]
web1: Pending          [pod status: 0/3 ready, 3/3 pending, 0/3 failed]
db1: Ready             [pod status: 1/2 ready, 1/2 pending, 0/2 failed]
web1: Ready            [pod status: 1/3 ready, 2/3 pending, 0/3 failed]
 
Stack hellostack is stable and running
 
NAME        SERVICES  PORTS       STATUS                           CREATED AT
hellostack  2         web1: 8082  Progressing (Stack is starting)  2019-01-21T14:30:10Z

验证 Stack

[node1 pwk]$ kubectl get stack
NAME        SERVICES  PORTS       STATUS                        CREATED AT
hellostack  2         web1: 8082  Available (Stack is started)  2019-01-21T14:30:10Z

推荐阅读
  • baresip android编译、运行教程1语音通话
    本文介绍了如何在安卓平台上编译和运行baresip android,包括下载相关的sdk和ndk,修改ndk路径和输出目录,以及创建一个c++的安卓工程并将目录考到cpp下。详细步骤可参考给出的链接和文档。 ... [详细]
  • 如何用UE4制作2D游戏文档——计算篇
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了如何用UE4制作2D游戏文档——计算篇相关的知识,希望对你有一定的参考价值。 ... [详细]
  • 本文介绍了计算机网络的定义和通信流程,包括客户端编译文件、二进制转换、三层路由设备等。同时,还介绍了计算机网络中常用的关键词,如MAC地址和IP地址。 ... [详细]
  • imx6ull开发板驱动MT7601U无线网卡的方法和步骤详解
    本文详细介绍了在imx6ull开发板上驱动MT7601U无线网卡的方法和步骤。首先介绍了开发环境和硬件平台,然后说明了MT7601U驱动已经集成在linux内核的linux-4.x.x/drivers/net/wireless/mediatek/mt7601u文件中。接着介绍了移植mt7601u驱动的过程,包括编译内核和配置设备驱动。最后,列举了关键词和相关信息供读者参考。 ... [详细]
  • 本文由编程笔记#小编为大家整理,主要介绍了StartingzookeeperFAILEDTOSTART相关的知识,希望对你有一定的参考价值。下载路径:https://ar ... [详细]
  • 本文整理了315道Python基础题目及答案,帮助读者检验学习成果。文章介绍了学习Python的途径、Python与其他编程语言的对比、解释型和编译型编程语言的简述、Python解释器的种类和特点、位和字节的关系、以及至少5个PEP8规范。对于想要检验自己学习成果的读者,这些题目将是一个不错的选择。请注意,答案在视频中,本文不提供答案。 ... [详细]
  • 初识java关于JDK、JRE、JVM 了解一下 ... [详细]
  • 有意向可以发简历到邮箱内推.简历直达组内Leader.能做同事的话,内推奖励全给你. ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • Android中高级面试必知必会,积累总结
    本文介绍了Android中高级面试的必知必会内容,并总结了相关经验。文章指出,如今的Android市场对开发人员的要求更高,需要更专业的人才。同时,文章还给出了针对Android岗位的职责和要求,并提供了简历突出的建议。 ... [详细]
  • 使用Ubuntu中的Python获取浏览器历史记录原文: ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 本文介绍了RxJava在Android开发中的广泛应用以及其在事件总线(Event Bus)实现中的使用方法。RxJava是一种基于观察者模式的异步java库,可以提高开发效率、降低维护成本。通过RxJava,开发者可以实现事件的异步处理和链式操作。对于已经具备RxJava基础的开发者来说,本文将详细介绍如何利用RxJava实现事件总线,并提供了使用建议。 ... [详细]
  • 十大经典排序算法动图演示+Python实现
    本文介绍了十大经典排序算法的原理、演示和Python实现。排序算法分为内部排序和外部排序,常见的内部排序算法有插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等。文章还解释了时间复杂度和稳定性的概念,并提供了相关的名词解释。 ... [详细]
  • 本文分析了Wince程序内存和存储内存的分布及作用。Wince内存包括系统内存、对象存储和程序内存,其中系统内存占用了一部分SDRAM,而剩下的30M为程序内存和存储内存。对象存储是嵌入式wince操作系统中的一个新概念,常用于消费电子设备中。此外,文章还介绍了主电源和后备电池在操作系统中的作用。 ... [详细]
author-avatar
冬-冰释_488
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有