Loading

Mesos(DC/OS)命令行参考

查看节点列表

[root@ip-172-31-34-218 ~]# dcos node list
    HOSTNAME          IP        PUBLIC IP(S)                     ID                          TYPE        STATUS      REGION           ZONE
  172.31.43.178  172.31.43.178  172.31.43.178  ff4f14ff-2887-4816-babe-1d7fb100145f-S1  agent (public)   ACTIVE  ap-northeast-1  ap-northeast-1a
  172.31.41.246  172.31.41.246  172.31.41.246  ff4f14ff-2887-4816-babe-1d7fb100145f-S0  agent            ACTIVE  ap-northeast-1  ap-northeast-1a
  master.mesos.  172.31.43.15   172.31.43.15   ff4f14ff-2887-4816-babe-1d7fb100145f     master (leader)          ap-northeast-1  ap-northeast-1a

查看已安装的marathon应用程序列表

[root@ip-172-31-34-218 ~]# dcos marathon app  list
ID               MEM    CPUS  TASKS  HEALTH  DEPLOYMENT  WAITING  CONTAINER  CMD                                    ROLE
/dcos-101/app2  128.0   1.0    1/1    N/A       ---      False       N/A     chmod u+x app2 && ./app2             dcos-101
/hello-world     10.0   0.1    2/2    N/A       ---      False      MESOS    while [ true ]; do echo 'Hello...  slave_public
/nginx          1024.0  1.0    1/1    1/1       ---      False      DOCKER   N/A                                slave_public

通过marathon创建服务

[root@ip-172-31-34-218 ~]# ls
anaconda-ks.cfg  ip-detect.sh  my-app.json  
[root@ip-172-31-34-218 ~]# dcos marathon app add my-app.json
Created deployment a8b063b4-d277-40a9-bd08-424dcc9526fa

重启marathon应用程序

[root@ip-172-31-34-218 ~]# dcos marathon app restart /hello-world
Created deployment f9fa977e-d6d7-49cb-b020-dcd98c84874d
[root@ip-172-31-34-218 ~]# dcos marathon app  list
ID               MEM    CPUS  TASKS  HEALTH  DEPLOYMENT  WAITING  CONTAINER  CMD                                    ROLE
/dcos-101/app2  128.0   1.0    1/1    N/A       ---      False       N/A     chmod u+x app2 && ./app2             dcos-101
/hello-world     10.0   0.1    2/2    N/A       ---      False      MESOS    while [ true ]; do echo 'Hello...  slave_public
/nginx          1024.0  1.0    1/1    1/1       ---      False      DOCKER   N/A                                slave_public

查看marathon某个app的具体信息

[root@ip-172-31-34-218 ~]# dcos marathon app show my-web

在Universe 存储库中搜索 redis软件包

[root@ip-172-31-34-218 ~]# dcos package search redis
    NAME     VERSION   CERTIFIED  FRAMEWORK                                    DESCRIPTION
  mr-redis  0.0.1      false      true       Redis is the fastest in-memory KV-Cache and Datatstructure store
  redis     4.0-0.0.1  false      false      This is a single redis container, which is NOT suited for HA setups. Redis i...
[root@ip-172-31-34-218 ~]# dcos package search nginx
  NAME   VERSION  CERTIFIED  FRAMEWORK                                    DESCRIPTION
  nginx  1.10.3   false      false      nginx is a high performance HTTP and reverse proxy server. An example for th...

部署redis软件包

[root@ip-172-31-34-218 ~]# dcos package install redis
By Deploying, you agree to the Terms and Conditions https://mesosphere.com/catalog-terms-conditions/#community-services
This DC/OS Service is currently in preview. There may be bugs, incomplete features, incorrect documentation, or other discrepancies. Redis requires a single node with 300MB of RAM and 0.1 CPUs.
Continue installing? [yes/no] yes
Installing Marathon app for package [redis] version [4.0-0.0.1]
Redis installed!

查看部署的软件包

[root@ip-172-31-34-218 ~]# dcos task
Getting the list of tasks from `dcos task` is deprecated. Please use `dcos task list`.
  NAME       HOST       USER     STATE                                  ID                                             AGENT ID                      REGION           ZONE
  redis  172.31.41.246  root  TASK_RUNNING  redis.instance-cfb15c87-1577-11ea-b05d-323b5d2dd365._app.1  ff4f14ff-2887-4816-babe-1d7fb100145f-S0  ap-northeast-1  ap-northeast-1a
[root@ip-172-31-34-218 ~]#

通过查看 Redis 日志

dcos task log redis。此命令将向我们显示 redis 任务的日志(stdout 和 stderr)。这让您可以检查实际启动是否成功。您可以使用 --lines= 参数增加显示的日志行数;默认值为 10。 *让我们通过 redis-cli 命令手动存储密钥来使用 Redis
[root@ip-172-31-34-218 ~]# dcos task log redis
1:C 03 Dec 02:51:38.160 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 03 Dec 02:51:38.161 # Redis version=4.0.14, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 03 Dec 02:51:38.161 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 03 Dec 02:51:38.163 * Running mode=standalone, port=6379.
1:M 03 Dec 02:51:38.163 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 03 Dec 02:51:38.163 # Server initialized
1:M 03 Dec 02:51:38.163 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 03 Dec 02:51:38.163 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 03 Dec 02:51:38.163 * Ready to accept connections

posted @ 2019-12-05 16:04  宋某人  阅读(638)  评论(0编辑  收藏  举报