mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
c37a3a237c
@ -1,89 +1,88 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (What is IPv6, and why aren’t we there yet?)
|
||||
[#]: via: (https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html)
|
||||
[#]: author: (Keith Shaw and Josh Fruhlinger )
|
||||
[#]: author: (Keith Shaw, Josh Fruhlinger )
|
||||
|
||||
What is IPv6, and why aren’t we there yet?
|
||||
什么是 IPv6,为什么我们还普及?
|
||||
======
|
||||
IPv6 has been in the works since 1998 to address the shortfall of IP addresses available under Ipv4, yet despite its efficiency and security advantages, adoption is still slow.
|
||||
Thinkstock
|
||||
|
||||
For the most part the dire warnings about running out of internet addresses have ceased because, slowly but surely, migration from the world of Internet Protocol Version 4 (IPv4) to IPv6 has begun, and software is in place to prevent the address apocalypse that many were predicting.
|
||||
自 1998 年以来,IPv6 一直在努力解决 IPv4 可用 IP 地址的不足的问题,然而尽管 IPv6 在效率和安全方面具有优势,但其采用速度仍然缓慢。
|
||||
|
||||
But before we see where are and where we’re going with IPv6, let’s go back to the early days of internet addressing.
|
||||
![](https://images.idgesg.net/images/article/2017/11/ipv6newip-100740801-large.jpg)
|
||||
|
||||
**[ Related: [IPv6 deployment guide][1] + [How to plan your migration to IPv6][2] ]**
|
||||
在大多数情况下,已经没人一再警告互联网地址耗尽的可怕境况,因为,虽然缓慢,但坚定地,从互联网协议版本 4(IPv4)的世界到 IPv6 的迁移已经开始,并且相关软件已经到位,以防止许多人预测的地址耗竭。
|
||||
|
||||
### What is IPv6 and why is it important?
|
||||
但在我们看到 IPv6 的现状和发展方向之前,让我们先回到互联网寻址的早期。
|
||||
|
||||
IPv6 is the latest version of the Internet Protocol, which identifies devices across the internet so they can be located. Every device that uses the internet is identified through its own IP address in order for internet communication to work. In that respect, it’s just like the street addresses and zip codes you need to know in order to mail a letter.
|
||||
### 什么是 IPv6,为什么它很重要?
|
||||
|
||||
The previous version, IPv4, uses a 32-bit addressing scheme to support 4.3 billion devices, which was thought to be enough. However, the growth of the internet, personal computers, smartphones and now Internet of Things devices proves that the world needed more addresses.
|
||||
IPv6 是最新版本的<ruby>互联网协议<rt>Internet Protocol</rt></ruby>(IP),它可以识别互联网上的设备,从而确定它们的位置。每一个使用互联网的设备都要通过自己的 IP 地址来识别,以便互联网通信工作。在这方面,它就像你需要知道的街道地址和邮政编码一样,以便邮寄信件。
|
||||
|
||||
Fortunately, the Internet Engineering Task Force (IETF) recognized this 20 years ago. In 1998 it created IPv6, which instead uses 128-bit addressing to support approximately 340 trillion trillion (or 2 to the 128th power, if you like). Instead of the IPv4 address method of four sets of one- to three-digit numbers, IPv6 uses eight groups of four hexadecimal digits, separated by colons.
|
||||
之前的版本 IPv4 采用 32 位寻址方案,可以支持 43 亿台设备,本以为已经足够。然而,互联网、个人电脑、智能手机以及现在物联网设备的发展证明,这个世界需要更多的地址。
|
||||
|
||||
### What are the benefits of IPv6?
|
||||
幸运的是,<ruby>互联网工程任务组<rt>Internet Engineering Task Force</rt></ruby>(IETF)在 20 年前就认识到了这一点。1998 年,它创建了 IPv6,使用 128 位寻址方式来支持大约 340 <ruby>亿亿亿<rt>trillion trillion</rt></ruby>(或者 2 的 128 次幂,如果你喜欢的话)。IPv4 的地址可表示为四组一至三位十进制数,IPv6 则使用八组四位十六进制数字,用冒号隔开。
|
||||
|
||||
In its work, the IETF included enhancements to IPv6 compared with IPv4. The IPv6 protocol can handle packets more efficiently, improve performance and increase security. It enables internet service providers to reduce the size of their routing tables by making them more hierarchical.
|
||||
### IPv6 的好处是什么?
|
||||
|
||||
### Network address translation (NAT) and IPv6
|
||||
IETF 在其工作中加入了 IPv6 对 IPv4 增强的功能。IPv6 协议可以更有效地处理数据包,提高性能和增加安全性。它使互联网服务提供商(ISP)能够通过使他们的路由表更有层次性来减少其大小。
|
||||
|
||||
Adoption of IPv6 has been delayed in part due to network address translation (NAT), which takes private IP addresses and turns them into public IP addresses. That way a corporate machine with a private IP address can send to and receive packets from machines located outside the private network that have public IP addresses.
|
||||
### 网络地址转换(NAT)和 IPv6
|
||||
|
||||
Without NAT, large corporations with thousands or tens of thousands of computers would devour enormous quantities of public IPv4 addresses if they wanted to communicate with the outside world. But those IPv4 addresses are limited and nearing exhaustion to the point of having to be rationed.
|
||||
IPv6 的采用被推迟,部分原因是<ruby>网络地址转换<rt>network address translation</rt></ruby>(NAT)导致的,它将私有 IP 地址转化为公共 IP 地址。这样一来,拥有私也 IP 地址的企业的机器就可以向位于私人网络之外拥有公共 IP 地址的机器发送和接收数据包。
|
||||
|
||||
NAT helps alleviate the problem. With NAT, thousands of privately addressed computers can be presented to the public internet by a NAT machine such as a firewall or router.
|
||||
如果没有 NAT,拥有数千台或数万台计算机的大公司如果要与外界通信,就会吞噬大量的公有 IPv4 地址。但是这些 IPv4 地址是有限的,而且接近枯竭,以至于不得不限制分配。
|
||||
|
||||
The way NAT works is when a corporate computer with a private IP address sends a packet to a public IP address outside the corporate network, it first goes to the NAT device. The NAT notes the packet’s source and destination addresses in a translation table.
|
||||
NAT 有助于缓解这个问题。有了 NAT,成千上万的私有地址计算机可以通过防火墙或路由器等 NAT 机器呈现在公共互联网上。
|
||||
|
||||
The NAT changes the source address of the packet to the public-facing address of the NAT device and sends it along to the external destination. When a packet replies, the NAT translates the destination address to the private IP address of the computer that initiated the communication. This can be done so that a single public IP address can represent multiple privately addressed computers.
|
||||
NAT 的工作方式是,当一台拥有私有 IP 地址的企业计算机向企业网络外的公共 IP 地址发送数据包时,首先会进入 NAT 设备。NAT 在翻译表中记下数据包的源地址和目的地址。
|
||||
|
||||
### Who is deploying IPv6?
|
||||
NAT 将数据包的源地址改为 NAT 设备面向公众的地址,并将数据包一起发送到外部目的地。当数据包回复时,NAT 将目的地址翻译成发起通信的计算机的私有 IP 地址。这样一来,一个公网 IP 地址可以代表多台私有地址的计算机。
|
||||
|
||||
Carrier networks and ISPs have been the first group to start deploying IPv6 on their networks, with mobile networks leading the charge. For example, T-Mobile USA has more than 90% of its traffic going over IPv6, with Verizon Wireless close behind at 82.25%. Comcast and AT&T have its networks at 63% and 65%, respectively, according to the industry group [World Ipv6 Launch][3].
|
||||
### 谁在部署 IPv6?
|
||||
|
||||
Major websites are following suit - just under 30% of the Alexa Top 1000 websites are currently reachable over IPv6, World IPv6 Launch says.
|
||||
运营商网络和互联网服务供应商是最早开始在其网络上部署 IPv6 的群体,其中移动网络处于领先地位。例如,T-Mobile USA 有超过 90% 的流量通过 IPv6,Verizon Wireless 紧随其后,占 82.25%。根据行业组织 [World Ipv6 Launch][3] 的数据,Comcast 和 AT&T 的网络分别为 63% 和 65%。
|
||||
|
||||
Enterprises are trailing in deployment, with slightly under one-fourth of enterprises advertising IPv6 prefixes, according to the Internet Society’s [“State of IPv6 Deployment 2017” report][4]. Complexity, costs and time needed to complete are all reasons given. In addition, some projects have been delayed due to software compatibility. For example, a [January 2017 report][5] said a bug in Windows 10 was “undermining Microsoft’s efforts to roll out an IPv6-only network at its Seattle headquarters.”
|
||||
主要网站则排在其后 —— World IPv6 Launch 称,目前 Alexa 前 1000 的网站中只有不到 30% 可以通过 IPv6 到达。
|
||||
|
||||
### When will more deployments occur?
|
||||
企业在部署方面比较落后,根据<ruby>互联网协会<rt>Internet Society</rt></ruby>的[《2017年 IPv6 部署状况》报告][4],只有不到四分之一的企业宣传其 IPv6 前缀。复杂性、成本和完成迁移所需时间都是给出的理由。此外,一些项目由于软件兼容性的问题而被推迟。例如,一份 [2017 年 1 月的报告][5]称,Windows 10 中的一个 bug “破坏了微软在其西雅图总部推出纯 IPv6 网络的努力”。
|
||||
|
||||
The Internet Society said the price of IPv4 addresses will peak in 2018, and then prices will drop after IPv6 deployment passes the 50% mark. Currently, [according to Google][6], the world has 20% to 22% IPv6 adoption, but in the U.S. it’s about 32%).
|
||||
### 何时会有更多部署?
|
||||
|
||||
As the price of IPv4 addresses begin to drop, the Internet Society suggests that enterprises sell off their existing IPv4 addresses to help fund IPv6 deployment. The Massachusetts Institute of Technology has done this, according to [a note posted on GitHub][7]. The university concluded that 8 million of its IPv4 addresses were “excess” and could be sold without impacting current or future needs since it also holds 20 nonillion IPv6 addresses. (A nonillion is the numeral one followed by 30 zeroes.)
|
||||
互联网协会表示,IPv4 地址的价格将在 2018 年达到顶峰,然后在 IPv6 部署通过 50% 大关后,价格会下降。目前,[根据 Google][6],全球的 IPv6 采用率为 20% 到 22%,但在美国约为 32%。
|
||||
|
||||
In addition, as more deployments occur, more companies will start charging for the use of IPv4 addresses, while providing IPv6 services for free. [UK-based ISP Mythic Beasts][8] says “IPv6 connectivity comes as standard,” while “IPv4 connectivity is an optional extra.”
|
||||
随着 IPv4 地址的价格开始下降,互联网协会建议企业出售现有的 IPv4 地址,以帮助资助其 IPv6 的部署。根据[一个发布在 GitHub 上的说明][7],麻省理工学院已经这样做了。这所大学得出的结论是,其 800 万个 IPv4 地址是“过剩”的,可以在不影响当前或未来需求的情况下出售,因为它还持有 20 个<ruby>非亿级<rt>nonillion</rt></ruby> IPv6 地址。(非亿级地址是指数字 1 后面跟着 30 个零)。
|
||||
|
||||
### When will IPv4 be “shut off”?
|
||||
此外,随着部署的增多,更多的公司将开始对 IPv4 地址的使用收费,而免费提供 IPv6 服务。[英国的 ISP Mythic Beasts][8] 表示,“IPv6 连接是标配”,而 “IPv4 连接是可选的额外服务”。
|
||||
|
||||
Most of the world [“ran out” of new IPv4 addresses][9] between 2011 and 2018 – but we won’t completely be out of them as IPv4 addresses get sold and re-used (as mentioned earlier), and any leftover addresses will be used for IPv6 transitions.
|
||||
### IPv4 何时会被“关闭”?
|
||||
|
||||
There’s no official switch-off date, so people shouldn’t be worried that their internet access will suddenly go away one day. As more networks transition, more content sites support IPv6 and more end users upgrade their equipment for IPv6 capabilities, the world will slowly move away from IPv4.
|
||||
在 2011 年至 2018 年期间,世界上大部分地区[“用完”了新的 IPv4 地址][9] —— 但我们不会完全没有了这些地址,因为 IPv4 地址会被出售和重新使用(如前所述),而任何剩余的地址将用于 IPv6 过渡。
|
||||
|
||||
### Why is there no IPv5?
|
||||
目前还没有正式的关闭日期,所以人们不应该担心有一天他们的互联网接入会突然消失。随着越来越多的网络过渡,越来越多的内容网站支持 IPv6,以及越来越多的终端用户为 IPv6 功能升级设备,世界将慢慢远离 IPv4。
|
||||
|
||||
There was an IPv5 that was also known as Internet Stream Protocol, abbreviated simply as ST. It was designed for connection-oriented communications across IP networks with the intent of supporting voice and video.
|
||||
### 为什么没有 IPv5?
|
||||
|
||||
It was successful at that task, and was used experimentally. One shortcoming that undermined its popular use was its 32-bit address scheme – the same scheme used by IPv4. As a result, it had the same problem that IPv4 had – a limited number of possible IP addresses. That led to the development and eventual adoption of IPv6. Even though IPv5 was never adopted publicly, it had used up the name IPv5.
|
||||
曾经有一个 IPv5,也被称为<ruby>互联网流协议<rt>Internet Stream Protocol</rt></ruby>,简称 ST。它被设计用于跨 IP 网络的面向连接的通信,目的是支持语音和视频。
|
||||
|
||||
Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind.
|
||||
它在这个任务上是成功的,并被实验性地使用。它的一个缺点是它的 32 位地址方案 —— 与 IPv4 使用的方案相同,从而影响了它的普及。因此,它存在着与 IPv4 相同的问题 —— 可用的 IP 地址数量有限。这导致了 IPv6 的发展和最终采用。尽管 IPv5 从未被公开采用,但它已经用掉了 IPv5 这个名字。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html
|
||||
|
||||
作者:[Keith Shaw and Josh Fruhlinger][a]
|
||||
作者:[Keith Shaw][a],[Josh Fruhlinger][c]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:
|
||||
[a]: https://www.networkworld.com/author/Keith-Shaw/
|
||||
[c]: https://www.networkworld.com/author/Josh-Fruhlinger/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.networkworld.com/article/3235805/lan-wan/ipv6-deployment-guide.html#tk.nww-fsb
|
||||
[2]: https://www.networkworld.com/article/3214388/lan-wan/how-to-plan-your-migration-to-ipv6.html#tk.nww-fsb
|
||||
|
@ -1,247 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (jlztan)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1)
|
||||
[#]: via: (https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/)
|
||||
[#]: author: (Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/)
|
||||
|
||||
Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1
|
||||
======
|
||||
|
||||
As **Docker** usage and adoption is growing faster and faster, monitoring **Docker container** images is becoming more challenging. As multiple Docker container images are getting created day-by-day, monitoring them is very important. There are already some in built tools and technologies, but configuring them is little complex. As micro-services based architecture is becoming the de-facto standard in coming days, learning such tool adds one more arsenal to your tool-set.
|
||||
|
||||
Based on the above scenarios, there was in need of one light weight and robust tool requirement was growing. So Portainer.io addressed this. “ **Portainer.io** “,(Latest version is 1.20.2) the tool is very light weight(with 2-3 commands only one can configure it) and has become popular among Docker users.
|
||||
|
||||
**This tool has advantages over other tools; some of these are as below** ,
|
||||
|
||||
* Light weight (requires only 2-3 commands to be required to run to install this tool) {Also installation image is only around 26-30MB of size)
|
||||
* Robust and easy to use
|
||||
* Can be used for Docker monitor and Build
|
||||
* This tool provides us a detailed overview of your Docker environments
|
||||
* This tool allows us to manage your containers, images, networks and volumes.
|
||||
* Portainer is simple to deploy – this requires just one Docker command (can be run from anywhere.)
|
||||
* Complete Docker-container environment can be monitored easily
|
||||
|
||||
|
||||
|
||||
**Portainer is also equipped with** ,
|
||||
|
||||
* Community support
|
||||
* Enterprise support
|
||||
* Has professional services available(along with partner OEM services)
|
||||
|
||||
|
||||
|
||||
**Functionality and features of Portainer tool are,**
|
||||
|
||||
1. It comes-up with nice Dashboard, easy to use and monitor.
|
||||
2. Many in-built templates for ease of operation and creation
|
||||
3. Support of services (OEM, Enterprise level)
|
||||
4. Monitoring of Containers, Images, Networks, Volume and configuration at almost real-time.
|
||||
5. Also includes Docker-Swarm monitoring
|
||||
6. User management with many fancy capabilities
|
||||
|
||||
|
||||
|
||||
**Read Also :[How to Install Docker CE on Ubuntu 16.04 / 18.04 LTS System][1]**
|
||||
|
||||
### How to install and configure Portainer.io on Ubuntu Linux / RHEL / CentOS
|
||||
|
||||
**Note:** This installation is done on Ubuntu 18.04 but the installation on RHEL & CentOS would be same. We are assuming Docker CE is already installed on your system.
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ lsb_release -a
|
||||
No LSB modules are available.
|
||||
Distributor ID: Ubuntu
|
||||
Description: Ubuntu 18.04 LTS
|
||||
Release: 18.04
|
||||
Codename: bionic
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
Create the Volume for portainer
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker volume create portainer_data
|
||||
portainer_data
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
Launch and start Portainer Container using the beneath docker command,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
|
||||
Unable to find image 'portainer/portainer:latest' locally
|
||||
latest: Pulling from portainer/portainer
|
||||
d1e017099d17: Pull complete
|
||||
0b1e707a06d2: Pull complete
|
||||
Digest: sha256:d6cc2c20c0af38d8d557ab994c419c799a10fe825e4aa57fea2e2e507a13747d
|
||||
Status: Downloaded newer image for portainer/portainer:latest
|
||||
35286de9f2e21d197309575bb52b5599fec24d4f373cc27210d98abc60244107
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
Once the complete installation is done, use the ip of host or Docker using port 9000 of the Docker engine where portainer is running using your browser.
|
||||
|
||||
**Note:** If OS firewall is enabled on your Docker host then make sure 9000 port is allowed else its GUI will not come up.
|
||||
|
||||
In my case, IP address of my Docker Host / Engine is “192.168.1.16” so URL will be,
|
||||
|
||||
<http://192.168.1.16:9000>
|
||||
|
||||
[![Portainer-Login-User-Name-Password][2]][3]
|
||||
|
||||
Please make sure that you enter 8-character passwords. Let the admin be the user as it is and then click “Create user”.
|
||||
|
||||
Now the following screen appears, in this select “Local” rectangle box.
|
||||
|
||||
[![Connect-Portainer-Local-Docker][4]][5]
|
||||
|
||||
Click on “Connect”
|
||||
|
||||
Nice GUI with admin as user home screen appears as below,
|
||||
|
||||
[![Portainer-io-Docker-Monitor-Dashboard][6]][7]
|
||||
|
||||
Now Portainer is ready to launch and manage your Docker containers and it can also be used for containers monitoring.
|
||||
|
||||
### Bring-up container image on Portainer tool
|
||||
|
||||
[![Portainer-Endpoints][8]][9]
|
||||
|
||||
Now check the present status, there are two container images are already running, if you create one more that appears instantly.
|
||||
|
||||
From your command line kick-start one or two containers as below,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker run --name test -it debian
|
||||
Unable to find image 'debian:latest' locally
|
||||
latest: Pulling from library/debian
|
||||
e79bb959ec00: Pull complete
|
||||
Digest: sha256:724b0fbbda7fda6372ffed586670573c59e07a48c86d606bab05db118abe0ef5
|
||||
Status: Downloaded newer image for debian:latest
|
||||
root@linuxtechi:/#
|
||||
```
|
||||
|
||||
Now click Refresh button (Are you sure message appears, click “continue” on this) in Portainer GUI, you will now see 3 container images as highlighted below,
|
||||
|
||||
[![Portainer-io-new-container-image][10]][11]
|
||||
|
||||
Click on the “ **containers** ” (in which it is red circled above), next window appears with “ **Dashboard Endpoint summary** ”
|
||||
|
||||
[![Portainer-io-Docker-Container-Dash][12]][13]
|
||||
|
||||
In this page, click on “ **Containers** ” as highlighted in red color. Now you are ready to monitor your container image.
|
||||
|
||||
### Simple Docker container image monitoring
|
||||
|
||||
From the above step, it appears that a fancy and nice looking “Container List” page appears as below,
|
||||
|
||||
[![Portainer-Container-List][14]][15]
|
||||
|
||||
All the container images can be controlled from here (stop, start, etc)
|
||||
|
||||
**1)** Now from this page, stop the earlier started {“test” container (this was the debian image that we started earlier)}
|
||||
|
||||
To do this select the check box in front of this image and click stop button from above,
|
||||
|
||||
[![Stop-Container-Portainer-io-dashboard][16]][17]
|
||||
|
||||
From the command line option, you will see that this image has been stopped or exited now,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker container ls -a
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
d45902e717c0 debian "bash" 21 minutes ago Exited (0) 49 seconds ago test
|
||||
08b96eddbae9 centos:7 "/bin/bash" About an hour ago Exited (137) 9 minutes ago mycontainer2
|
||||
35286de9f2e2 portainer/portainer "/portainer" 2 hours ago Up About an hour 0.0.0.0:9000->9000/tcp compassionate_benz
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
**2)** Now start the stopped containers (test & mycontainer2) from Portainer GUI,
|
||||
|
||||
Select the check box in front of stopped containers, and the click on Start
|
||||
|
||||
[![Start-Containers-Portainer-GUI][18]][19]
|
||||
|
||||
You will get a quick window saying, “ **Container successfully started** ” and with running state
|
||||
|
||||
[![Conatiner-Started-successfully-Portainer-GUI][20]][21]
|
||||
|
||||
### Various other options and features are explored as below step-by-step
|
||||
|
||||
**1)** Click on “ **Images** ” which is highlighted, you will get the below window,
|
||||
|
||||
[![Docker-Container-Images-Portainer-GUI][22]][23]
|
||||
|
||||
This is the list of container images that are available but some may not running. These images can be imported, exported or uploaded to various locations, below screen shot shows the same,
|
||||
|
||||
[![Upload-Docker-Container-Image-Portainer-GUI][24]][25]
|
||||
|
||||
**2)** Click on “ **volumes”** which is highlighted, you will get the below window,
|
||||
|
||||
[![Volume-list-Portainer-io-gui][26]][27]
|
||||
|
||||
**3)** Volumes can be added easily with following option, click on add volume button, below window appears,
|
||||
|
||||
Provide the name as “ **myvol** ” in the name box and click on “ **create the volume** ” button.
|
||||
|
||||
[![Volume-Creation-Portainer-io-gui][28]][29]
|
||||
|
||||
The newly created volume appears as below, (with unused state)
|
||||
|
||||
[![Volume-unused-Portainer-io-gui][30]][31]
|
||||
|
||||
#### Conclusion:
|
||||
|
||||
As from the above installation steps, configuration and playing around with various options you can see how easy and fancy looking is Portainer.io tool is. This provides multiple features and options to explore on building, monitoring docker container. As explained this is very light weight tool, so doesn’t add any overload to host system. Next set-of options will be explored in part-2 of this series.
|
||||
|
||||
Read Also: **[Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-2][32]**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/
|
||||
|
||||
作者:[Shashidhar Soppin][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linuxtechi.com/author/shashidhar/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linuxtechi.com/how-to-setup-docker-on-ubuntu-server-16-04/
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password-1024x681.jpg
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password.jpg
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker-1024x538.jpg
|
||||
[5]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker.jpg
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard-1024x544.jpg
|
||||
[7]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard.jpg
|
||||
[8]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints-1024x252.jpg
|
||||
[9]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints.jpg
|
||||
[10]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image-1024x544.jpg
|
||||
[11]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image.jpg
|
||||
[12]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash-1024x544.jpg
|
||||
[13]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash.jpg
|
||||
[14]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List-1024x538.jpg
|
||||
[15]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List.jpg
|
||||
[16]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard-1024x447.jpg
|
||||
[17]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard.jpg
|
||||
[18]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI-1024x449.jpg
|
||||
[19]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI.jpg
|
||||
[20]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI-1024x538.jpg
|
||||
[21]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI.jpg
|
||||
[22]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI-1024x544.jpg
|
||||
[23]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI.jpg
|
||||
[24]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI-1024x544.jpg
|
||||
[25]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI.jpg
|
||||
[26]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui-1024x544.jpg
|
||||
[27]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui.jpg
|
||||
[28]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui-1024x544.jpg
|
||||
[29]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui.jpg
|
||||
[30]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui-1024x544.jpg
|
||||
[31]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui.jpg
|
||||
[32]: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-io-part-2/
|
@ -1,132 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Manage your SSH connections with this open source tool)
|
||||
[#]: via: (https://opensource.com/article/20/9/ssh-connection-manager)
|
||||
[#]: author: (Kenneth Aaron https://opensource.com/users/flyingrhino)
|
||||
|
||||
Manage your SSH connections with this open source tool
|
||||
======
|
||||
This open source project makes connecting to any SSH session quick and
|
||||
seamless, and downright relaxing.
|
||||
![Penguins][1]
|
||||
|
||||
OpenSSH is widely used, but there isn't a well-known connection manager, so I developed the ncurses SSH connection manager (`nccm`) to fill that significant gap in the process. `nccm` is a simple SSH connection manager with an ultra-portable terminal interface (written in ncurses, as the project name suggests). And best of all, it's straightforward to use. With `nccm`, you can connect to an SSH session of your choice with minimum distraction and minimal keystrokes.
|
||||
|
||||
### Install nccm
|
||||
|
||||
The quickest way to get going is to clone the project from its [Git repository][2]:
|
||||
|
||||
|
||||
```
|
||||
`$ git clone https://github.com/flyingrhinonz/nccm nccm.git`
|
||||
```
|
||||
|
||||
In the `nccm.git/nccm` directory, there are two files—`nccm` itself and an `nccm.yml` configuration file.
|
||||
|
||||
First, copy the nccm script to `/usr/local/bin/` and grant it executable permissions. You can do this in one step with the `install` command:
|
||||
|
||||
|
||||
```
|
||||
$ sudo install -m755 nccm
|
||||
–target-directory /usr/local/bin
|
||||
```
|
||||
|
||||
The `nccm.yml` file can be copied to any one of these locations, and is loaded from the first location found:
|
||||
|
||||
* `~/.config/nccm/nccm.yml`
|
||||
* `~/.nccm.yml`
|
||||
* `~/nccm.yml`
|
||||
* `/etc/nccm.yml`
|
||||
|
||||
|
||||
|
||||
The `nccm` command requires Python 3 to be installed on your machine, which shouldn't be a problem on most Linux boxes. Most Python library dependencies are already present as part of Python 3; however, there are some YAML dependencies and utilities you must install.
|
||||
|
||||
If you don't have `pip` installed, you can install it with your package manager. And while you're at it, install the `yamllint` application to help you validate the `nccm.yml` file.
|
||||
|
||||
On Debian or similar, use `apt`:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo apt install python3-pip yamllint`
|
||||
```
|
||||
|
||||
On Fedora or similar, use `dnf`:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install python3-pip yamllint`
|
||||
```
|
||||
|
||||
You also need PyYAML, which you can install with the `pip` command:
|
||||
|
||||
|
||||
```
|
||||
`$ pip3 install --user PyYAML`
|
||||
```
|
||||
|
||||
### Using nccm
|
||||
|
||||
Before starting, edit the `nccm.yml` file and add your SSH configuration. Formatting YAML is easy, and there are examples provided in the file. Just follow the structure—provide the connection name at the beginning of the line, with config items indented two spaces. Don't forget the colons—these are part of the YAML language.
|
||||
|
||||
Don't worry about ordering your SSH session blocks in any specific way, because `nccm` gives you "sort by" options within the program.
|
||||
|
||||
Once you've finished editing, check your work with `yamllint`:
|
||||
|
||||
|
||||
```
|
||||
`$ yamllint ~/.config/nccm/nccm.yml`
|
||||
```
|
||||
|
||||
If no errors are returned, then you've formatted your file correctly, and it's safe to continue.
|
||||
|
||||
If `nccm` is accessible [from your path][3] and is executable, then typing `nccm` is all that's required to launch the TUI (terminal user interface). If you see Python 3 exceptions, check whether you have satisfied the dependencies. Any exceptions should mention any package that's missing.
|
||||
|
||||
As long as you're using the YAML config file without changing `nccm_config_control mode`, then you can use these keyboard controls:
|
||||
|
||||
* Up/Down arrows - Move the marker the traditional way
|
||||
* Home/End - Jump marker to list first/last entry
|
||||
* PgUp/PgDn - Page up/down in the list
|
||||
* Left/Right arrows - Scroll the list horizontally
|
||||
* TAB - Moves the cursor between text boxes
|
||||
* Enter - Connect to the selected entry
|
||||
* Ctrl-h - Display this help menu
|
||||
* Ctrl-q or Ctrl-c - Quit the program
|
||||
* F1-F5 or !@#$% - Sort by respective column (1-5)
|
||||
|
||||
|
||||
|
||||
Use keys F1 through F5 to sort by columns 1 through 5. If your desktop captures F-key input, you can instead sort by pressing **!@#$%** in the "Conn" text box. The display shows 4 visible columms but we treat username and server address as separate columns for sorting purposes giving us 5 controls for sorting. You can reverse the order by pressing the same "sort" key a second time. A connection can be made by pressing **Enter** on the highlighted line.
|
||||
|
||||
![nccm screenshot terminal view][4]
|
||||
|
||||
Typing text into the "Filter" text box filters the output with an "and" function between everything entered. This is case-insensitive, and a blank space delimits entries. The same is true for the "Conn" text box, but pressing **Enter** here connects to that specific entry number.
|
||||
|
||||
There are a few more interesting features to discover, such as focus mode, but I'll leave it up to you to explore the details. See the project page or built-in help for more details.
|
||||
|
||||
The config YAML file is well-documented, so you'll know how to edit the settings to make `nccm` work best for you. The `nccm` program is highly commented, too, so you may wish to fork or mod it to add more features. Pull requests are welcome!
|
||||
|
||||
### Relax into SSH with nccm
|
||||
|
||||
I hope this program serves you well and is as useful to you as it is to me. Thanks for being part of the open source community, and please accept `nccm` as my contribution to the ongoing efforts toward seamless, painless, and efficient computing experiences.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/9/ssh-connection-manager
|
||||
|
||||
作者:[Kenneth Aaron][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/flyingrhino
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ (Penguins)
|
||||
[2]: https://github.com/flyingrhinonz/nccm
|
||||
[3]: https://opensource.com/article/17/6/set-path-linux
|
||||
[4]: https://opensource.com/sites/default/files/uploads/nccm_screenshot.png (nccm screenshot terminal view)
|
@ -1,135 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux)
|
||||
[#]: via: (https://itsfoss.com/long-shutdown-linux/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux
|
||||
======
|
||||
|
||||
_**Your Linux system is taking too long to shut down? Here are the steps you can take to find out what is causing the delayed shutdown and fix the issue.**_
|
||||
|
||||
I hope you are a tad bit familiar with the [sigterm and sigkill][1] concept.
|
||||
|
||||
When you [shut down your Linux system][2], it sends the sigterm and politely asks the running processes to stop. Some processes misbehave and they ignore the sigterm and keep on running.
|
||||
|
||||
This could cause a delay to the shutdown process as your system will wait for the running processes to stop for a predefined time period. After this time period, it sends the kill signal to force stop all the remaining running processes and shuts down the system.
|
||||
|
||||
In fact, in some cases, you would see a message like ‘a stop job is running’ on the black screen.
|
||||
|
||||
If your system is taking too long in shutting down, you can do the following:
|
||||
|
||||
* Check which process/service is taking too long and if you can remove or reconfigure it to behave properly.
|
||||
* Change the default waiting period before your system force stops the running processes. [Quick and dirty fix]
|
||||
|
||||
|
||||
|
||||
I am using Ubuntu here which uses systemd. The commands and steps here are valid for any Linux distribution that uses systemd (most of them do).
|
||||
|
||||
![][3]
|
||||
|
||||
### Check which processes are causing long shutdown in Linux
|
||||
|
||||
If you want to figure out what’s wrong, you should check what happened at the last shutdown. Use this command to get the power of ‘I know what you did last session’ (pun intended):
|
||||
|
||||
```
|
||||
journalctl -rb -1
|
||||
```
|
||||
|
||||
The [journalctl command][4] allows you to read system logs. With options ‘-b -1’ you filter the logs for the last boot session. With option ‘-r’, the logs are shown in reverse chronological order.
|
||||
|
||||
In other words, the ‘journalctl -rb -1’ command will show the system logs just before your Linux system was shutdown the last time. This is what you need to analyze the long shutdown problem in Linux.
|
||||
|
||||
No journal logs? Here’s what you should do
|
||||
|
||||
If there are no journal logs, please make sure that your distribution uses systemd.
|
||||
|
||||
Even on some Linux distributions with systemd, the journal logs are not activated by default.
|
||||
|
||||
Make sure that /var/log/journal exists. If it doesn’t, create it:
|
||||
|
||||
```
|
||||
sudo mkdir /var/log/journal
|
||||
```
|
||||
|
||||
You should also check the content of /etc/systemd/journald.conf file and make sure that the value of Storage is set to either auto or persistent.
|
||||
|
||||
Do you find something suspicious in the logs? Is there a process/service refusing to stop? If yes, investigate if you could remove it without side effects or if you could reconfigure it. Don’t go blindly removing stuff here, please. You should have knowledge of the process.
|
||||
|
||||
### Speed up shutdown in Linux by reducing default stop timeout [Quick fix]
|
||||
|
||||
The default wait period for the shut down is usually set at 90 seconds. Your system tries to force stop the services after this time period.
|
||||
|
||||
If you want your Linux system to shut down quickly, you can change this waiting period.
|
||||
|
||||
You’ll find all the systemd settings in the config file located at /etc/systemd/system.conf. This file should be filled with lots of line starting with #. They represent the default values of the entries in the file.
|
||||
|
||||
Before you do anything, it will be a good idea to make a copy of the original file.
|
||||
|
||||
```
|
||||
sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.orig
|
||||
```
|
||||
|
||||
Look for DefaultTimeoutStopSec here. It should probably be set to 90 sec.
|
||||
|
||||
```
|
||||
#DefaultTimeoutStopSec=90s
|
||||
```
|
||||
|
||||
You have to change this value to something more convenient like 5 or 10 seconds.
|
||||
|
||||
```
|
||||
DefaultTimeoutStopSec=5s
|
||||
```
|
||||
|
||||
If you don’t know how to edit the config file in terminal, use this command to open the file for editing in your system’s default text editor (like Gedit):
|
||||
|
||||
```
|
||||
sudo xdg-open /etc/systemd/system.conf
|
||||
```
|
||||
|
||||
![Change Shutdown Time Settings Ubuntu][5]
|
||||
|
||||
Don’t forget to **remove the # before DefaultTimeoutStopSec**. Save the file and reboot your system.
|
||||
|
||||
This should help you reduce the shutdown delay for your Linux system.
|
||||
|
||||
Watchdog issue!
|
||||
|
||||
Linux has a module named watchdog that is used for monitoring whether certain services are running or not. It could be configured to automatically reboot systems if they are hanged due to software error.
|
||||
|
||||
It is unusual to use Watchdog on desktop systems because you can manually shutdown or reboot the system. It is often used on remote servers.
|
||||
|
||||
First check watchdog is running:
|
||||
|
||||
```
|
||||
ps -af | grep watch*
|
||||
```
|
||||
|
||||
If watchdog is running on your system, you can change the ShutdownWatchdogSec value from 10 minutes to something lower in the systemd config file /etc/systemd/system.conf.
|
||||
|
||||
**Were you able to fix the lengthy shutdown?**
|
||||
|
||||
I hope this tutorial helped you in investigating and fixing the long shutdown issue on your system. Do let me know in the comments if you managed to fix it.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/long-shutdown-linux/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://linuxhandbook.com/sigterm-vs-sigkill/
|
||||
[2]: https://itsfoss.com/schedule-shutdown-ubuntu/
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/troubleshoot-long-shutdown-linux.gif?resize=800%2C450&ssl=1
|
||||
[4]: https://linuxhandbook.com/journalctl-command/
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/change-shutdown-time-settings-ubuntu.png?resize=797%2C322&ssl=1
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,324 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Improve your time management with Jupyter)
|
||||
[#]: via: (https://opensource.com/article/20/9/calendar-jupyter)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
Improve your time management with Jupyter
|
||||
======
|
||||
Discover how you are spending time by parsing your calendar with Python
|
||||
in Jupyter.
|
||||
![Calendar close up snapshot][1]
|
||||
|
||||
[Python][2] has incredibly scalable options for exploring data. With [Pandas][3] or [Dask][4], you can scale [Jupyter][5] up to big data. But what about small data? Personal data? Private data?
|
||||
|
||||
JupyterLab and Jupyter Notebook provide a great environment to scrutinize my laptop-based life.
|
||||
|
||||
My exploration is powered by the fact that almost every service I use has a web application programming interface (API). I use many such services: a to-do list, a time tracker, a habit tracker, and more. But there is one that almost everyone uses: _a calendar_. The same ideas can be applied to other services, but calendars have one cool feature: an open standard that almost all web calendars support: `CalDAV`.
|
||||
|
||||
### Parsing your calendar with Python in Jupyter
|
||||
|
||||
Most calendars provide a way to export into the `CalDAV` format. You may need some authentication for accessing this private data. Following your service's instructions should do the trick. How you get the credentials depends on your service, but eventually, you should be able to store them in a file. I store mine in my root directory in a file called `.caldav`:
|
||||
|
||||
|
||||
```
|
||||
import os
|
||||
with open(os.path.expanduser("~/.caldav")) as fpin:
|
||||
username, password = fpin.read().split()
|
||||
```
|
||||
|
||||
Never put usernames and passwords directly in notebooks! They could easily leak with a stray `git push`.
|
||||
|
||||
The next step is to use the convenient PyPI [caldav][6] library. I looked up the CalDAV server for my email service (yours may be different):
|
||||
|
||||
|
||||
```
|
||||
import caldav
|
||||
client = caldav.DAVClient(url="<https://caldav.fastmail.com/dav/>", username=username, password=password)
|
||||
```
|
||||
|
||||
CalDAV has a concept called the `principal`. It is not important to get into right now, except to know it's the thing you use to access the calendars:
|
||||
|
||||
|
||||
```
|
||||
principal = client.principal()
|
||||
calendars = principal.calendars()
|
||||
```
|
||||
|
||||
Calendars are, literally, all about time. Before accessing events, you need to decide on a time range. One week should be a good default:
|
||||
|
||||
|
||||
```
|
||||
from dateutil import tz
|
||||
import datetime
|
||||
now = datetime.datetime.now(tz.tzutc())
|
||||
since = now - datetime.timedelta(days=7)
|
||||
```
|
||||
|
||||
Most people use more than one calendar, and most people want all their events together. The `itertools.chain.from_iterable` makes this straightforward: ` `
|
||||
|
||||
|
||||
```
|
||||
import itertools
|
||||
|
||||
raw_events = list(
|
||||
itertools.chain.from_iterable(
|
||||
calendar.date_search(start=since, end=now, expand=True)
|
||||
for calendar in calendars
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
Reading all the events into memory is important, and doing so in the API's raw, native format is an important practice. This means that when fine-tuning the parsing, analyzing, and displaying code, there is no need to go back to the API service to refresh the data.
|
||||
|
||||
But "raw" is not an understatement. The events come through as strings in a specific format:
|
||||
|
||||
|
||||
```
|
||||
`print(raw_events[12].data)`[/code] [code]
|
||||
|
||||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//CyrusIMAP.org/Cyrus
|
||||
3.3.0-232-g4bdb081-fm-20200825.002-g4bdb081a//EN
|
||||
BEGIN:VEVENT
|
||||
DTEND:20200825T230000Z
|
||||
DTSTAMP:20200825T181915Z
|
||||
DTSTART:20200825T220000Z
|
||||
SUMMARY:Busy
|
||||
UID:
|
||||
1302728i-040000008200E00074C5B7101A82E00800000000D939773EA578D601000000000
|
||||
000000010000000CD71CC3393651B419E9458134FE840F5
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
```
|
||||
|
||||
Luckily, PyPI comes to the rescue again with another helper library, [vobject][7]:
|
||||
|
||||
|
||||
```
|
||||
import io
|
||||
import vobject
|
||||
|
||||
def parse_event(raw_event):
|
||||
data = raw_event.data
|
||||
parsed = vobject.readOne(io.StringIO(data))
|
||||
contents = parsed.vevent.contents
|
||||
return contents
|
||||
|
||||
[/code] [code]`parse_event(raw_events[12])`[/code] [code]
|
||||
|
||||
{'dtend': [<DTEND{}2020-08-25 23:00:00+00:00>],
|
||||
'dtstamp': [<DTSTAMP{}2020-08-25 18:19:15+00:00>],
|
||||
'dtstart': [<DTSTART{}2020-08-25 22:00:00+00:00>],
|
||||
'summary': [<SUMMARY{}Busy>],
|
||||
'uid': [<UID{}1302728i-040000008200E00074C5B7101A82E00800000000D939773EA578D601000000000000000010000000CD71CC3393651B419E9458134FE840F5>]}
|
||||
```
|
||||
|
||||
Well, at least it's a little better.
|
||||
|
||||
There is still some work to do to convert it to a reasonable Python object. The first step is to _have_ a reasonable Python object. The [attrs][8] library provides a nice start:
|
||||
|
||||
|
||||
```
|
||||
import attr
|
||||
from __future__ import annotations
|
||||
@attr.s(auto_attribs=True, frozen=True)
|
||||
class Event:
|
||||
start: datetime.datetime
|
||||
end: datetime.datetime
|
||||
timezone: Any
|
||||
summary: str
|
||||
```
|
||||
|
||||
Time to write the conversion code!
|
||||
|
||||
The first abstraction gets the value from the parsed dictionary without all the decorations:
|
||||
|
||||
|
||||
```
|
||||
def get_piece(contents, name):
|
||||
return contents[name][0].value
|
||||
|
||||
[/code] [code]`get_piece(_, "dtstart")`[/code] [code]` datetime.datetime(2020, 8, 25, 22, 0, tzinfo=tzutc())`
|
||||
```
|
||||
|
||||
Calendar events always have a start, but they sometimes have an "end" and sometimes a "duration." Some careful parsing logic can harmonize both into the same Python objects:
|
||||
|
||||
|
||||
```
|
||||
def from_calendar_event_and_timezone(event, timezone):
|
||||
contents = parse_event(event)
|
||||
start = get_piece(contents, "dtstart")
|
||||
summary = get_piece(contents, "summary")
|
||||
try:
|
||||
end = get_piece(contents, "dtend")
|
||||
except KeyError:
|
||||
end = start + get_piece(contents, "duration")
|
||||
return Event(start=start, end=end, summary=summary, timezone=timezone)
|
||||
```
|
||||
|
||||
Since it is useful to have the events in your _local_ time zone rather than UTC, this uses the local timezone:
|
||||
|
||||
|
||||
```
|
||||
`my_timezone = tz.gettz()`[/code] [code]`from_calendar_event_and_timezone(raw_events[12], my_timezone)`[/code] [code]` Event(start=datetime.datetime(2020, 8, 25, 22, 0, tzinfo=tzutc()), end=datetime.datetime(2020, 8, 25, 23, 0, tzinfo=tzutc()), timezone=tzfile('/etc/localtime'), summary='Busy')`
|
||||
```
|
||||
|
||||
Now that the events are real Python objects, they really should have some additional information. Luckily, it is possible to add methods retroactively to classes.
|
||||
|
||||
But figuring which _day_ an event happens is not that obvious. You need the day in the _local_ timezone:
|
||||
|
||||
|
||||
```
|
||||
def day(self):
|
||||
offset = self.timezone.utcoffset(self.start)
|
||||
fixed = self.start + offset
|
||||
return fixed.date()
|
||||
Event.day = property(day)
|
||||
|
||||
[/code] [code]`print(_.day)`[/code] [code]` 2020-08-25`
|
||||
```
|
||||
|
||||
Events are always represented internally as start/end, but knowing the duration is a useful property. Duration can also be added to the existing class:
|
||||
|
||||
|
||||
```
|
||||
def duration(self):
|
||||
return self.end - self.start
|
||||
Event.duration = property(duration)
|
||||
|
||||
[/code] [code]`print(_.duration)`[/code] [code]` 1:00:00`
|
||||
```
|
||||
|
||||
Now it is time to convert all events into useful Python objects:
|
||||
|
||||
|
||||
```
|
||||
all_events = [from_calendar_event_and_timezone(raw_event, my_timezone)
|
||||
for raw_event in raw_events]
|
||||
```
|
||||
|
||||
All-day events are a special case and probably less useful for analyzing life. For now, you can ignore them:
|
||||
|
||||
|
||||
```
|
||||
# ignore all-day events
|
||||
all_events = [event for event in all_events if not type(event.start) == datetime.date]
|
||||
```
|
||||
|
||||
Events have a natural order—knowing which one happened first is probably useful for analysis:
|
||||
|
||||
|
||||
```
|
||||
`all_events.sort(key=lambda ev: ev.start)`
|
||||
```
|
||||
|
||||
Now that the events are sorted, they can be broken into days:
|
||||
|
||||
|
||||
```
|
||||
import collections
|
||||
events_by_day = collections.defaultdict(list)
|
||||
for event in all_events:
|
||||
events_by_day[event.day].append(event)
|
||||
```
|
||||
|
||||
And with that, you have calendar events with dates, duration, and sequence as Python objects.
|
||||
|
||||
### Reporting on your life in Python
|
||||
|
||||
Now it is time to write reporting code! It is fun to have eye-popping formatting with proper headers, lists, important things in bold, etc.
|
||||
|
||||
This means HTML and some HTML templating. I like to use [Chameleon][9]:
|
||||
|
||||
|
||||
```
|
||||
template_content = """
|
||||
<html><body>
|
||||
<div tal:repeat="item items">
|
||||
<h2 tal:content="item[0]">Day</h2>
|
||||
<ul>
|
||||
<li tal:repeat="event item[1]"><span tal:replace="event">Thing</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body></html>"""
|
||||
```
|
||||
|
||||
One cool feature of Chameleon is that it will render objects using its `html` method. I will use it in two ways:
|
||||
|
||||
* The summary will be in **bold**
|
||||
* For most events, I will remove the summary (since this is my personal information)
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
def __html__(self):
|
||||
offset = my_timezone.utcoffset(self.start)
|
||||
fixed = self.start + offset
|
||||
start_str = str(fixed).split("+")[0]
|
||||
summary = self.summary
|
||||
if summary != "Busy":
|
||||
summary = "&lt;REDACTED&gt;"
|
||||
return f"<b>{summary[:30]}</b> \-- {start_str} ({self.duration})"
|
||||
Event.__html__ = __html__
|
||||
```
|
||||
|
||||
In the interest of brevity, the report will be sliced into one day's worth.
|
||||
|
||||
|
||||
```
|
||||
import chameleon
|
||||
from IPython.display import HTML
|
||||
template = chameleon.PageTemplate(template_content)
|
||||
html = template(items=itertools.islice(events_by_day.items(), 3, 4))
|
||||
HTML(html)
|
||||
```
|
||||
|
||||
#### When rendered, it will look something like this:
|
||||
|
||||
#### 2020-08-25
|
||||
|
||||
* **<REDACTED>** \-- 2020-08-25 08:30:00 (0:45:00)
|
||||
* **<REDACTED>** \-- 2020-08-25 10:00:00 (1:00:00)
|
||||
* **<REDACTED>** \-- 2020-08-25 11:30:00 (0:30:00)
|
||||
* **<REDACTED>** \-- 2020-08-25 13:00:00 (0:25:00)
|
||||
* **Busy** \-- 2020-08-25 15:00:00 (1:00:00)
|
||||
* **<REDACTED>** \-- 2020-08-25 15:00:00 (1:00:00)
|
||||
* **<REDACTED>** \-- 2020-08-25 19:00:00 (1:00:00)
|
||||
* **<REDACTED>** \-- 2020-08-25 19:00:12 (1:00:00)
|
||||
|
||||
|
||||
|
||||
### Endless options with Python and Jupyter
|
||||
|
||||
This only scratches the surface of what you can do by parsing, analyzing, and reporting on the data that various web services have on you.
|
||||
|
||||
Why not try it with your favorite service?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/9/calendar-jupyter
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot)
|
||||
[2]: https://opensource.com/resources/python
|
||||
[3]: https://pandas.pydata.org/
|
||||
[4]: https://dask.org/
|
||||
[5]: https://jupyter.org/
|
||||
[6]: https://pypi.org/project/caldav/
|
||||
[7]: https://pypi.org/project/vobject/
|
||||
[8]: https://opensource.com/article/19/5/python-attrs
|
||||
[9]: https://chameleon.readthedocs.io/en/latest/
|
@ -0,0 +1,242 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "jlztan"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1"
|
||||
[#]: via: "https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/"
|
||||
[#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/"
|
||||
|
||||
用 Portainer.io(图形界面工具)来监控和管理 Docker 容器 – 1
|
||||
======
|
||||
|
||||
随着 **Docker** 的使用量越来越大,监控 **Docker** 容器正在变得更有挑战性。每天都有大量的 Docker 容器被创建,因此如何监控它们就变得非常重要。已经有一些用于监控容器的构建工具和技术,不过对它们进行配置有一些复杂。随着基于微服务的架构正在变成接下来事实上的标准,学会这种技术将为你的知识库再添一项新技能。
|
||||
|
||||
基于上述场景,对一种轻量、健壮的镜像管理工具的需求日益增加。Portainer.io 解决了这个问题。“**Portainer.io**“(最新版本是 1.20.2)非常轻量(只有 2-3 个可以配置的命令),在 Docker 用户之间很流行。
|
||||
|
||||
**比起其他工具,这个工具有很多优势,其中一些如下所示:**
|
||||
|
||||
* 轻量(安装此工具仅需 2 到 3 个命令,与此同时安装镜像的大小在 26 M 到 30 M 之间)
|
||||
* 健壮且易用
|
||||
* 可用于 Docker 监控和构建
|
||||
* 提供对 Docker 环境的详细概况
|
||||
* 可以管理容器、镜像、网络和卷
|
||||
* Portainer 部署方便,仅需一个 Docker 命令(可以在任意地方运行)
|
||||
* 可以对完整的 Docker 容器环境进行监控
|
||||
|
||||
**Portainer 同时具有以下服务:**
|
||||
|
||||
- 社区支持
|
||||
- 企业支持
|
||||
- 与合作伙伴 OEM 服务一起的专业服务
|
||||
|
||||
**Portainer 的功能和特性如下:**
|
||||
|
||||
1. 配备了漂亮的仪表盘,易于使用和监控
|
||||
2. 自带大量内置模板,便于操作和创建
|
||||
3. 服务支持(仅 OEM 和企业用户)
|
||||
4. 对容器、镜像、网络、卷以及配置进行几乎实时的监控
|
||||
5. 包含 Docker 集群监控功能
|
||||
6. 功能多样的用户管理
|
||||
|
||||
**另请阅读:[如何在 Ubuntu 16.04 / 18.04 LTS 版本中安装 Docker CE][1]**
|
||||
|
||||
### 如何在 Ubuntu Linux / RHEL / CentOS 系统上安装和配置 Portainer.io
|
||||
|
||||
**注意:**下面的安装过程是在 Ubuntu 18.04 上完成的,但是对 RHEL 和 CentOS 同样适用,同时假设你已经在系统上安装了 Docker CE。
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ lsb_release -a
|
||||
No LSB modules are available.
|
||||
Distributor ID: Ubuntu
|
||||
Description: Ubuntu 18.04 LTS
|
||||
Release: 18.04
|
||||
Codename: bionic
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
为 Portainer 创建卷,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker volume create portainer_data
|
||||
portainer_data
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
使用下面的 Docker 命令来运行 Portainer 容器,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
|
||||
Unable to find image 'portainer/portainer:latest' locally
|
||||
latest: Pulling from portainer/portainer
|
||||
d1e017099d17: Pull complete
|
||||
0b1e707a06d2: Pull complete
|
||||
Digest: sha256:d6cc2c20c0af38d8d557ab994c419c799a10fe825e4aa57fea2e2e507a13747d
|
||||
Status: Downloaded newer image for portainer/portainer:latest
|
||||
35286de9f2e21d197309575bb52b5599fec24d4f373cc27210d98abc60244107
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
安装完成之后,通过主机或 Docker 的 IP 加上 Docker 引擎使用的 9000 端口在浏览器中打开 Portainer。
|
||||
|
||||
**注意:**如果 Docker 所在主机的系统防火墙开启,需要确保 9000 端口被放行,否则浏览器页面将无法打开。
|
||||
|
||||
在我这边,我的 Docker 主机/引擎的 IP 是“192.168.1.16”,所以 URL 就是
|
||||
|
||||
<http://192.168.1.16:9000>
|
||||
|
||||
[![Portainer-Login-User-Name-Password][2]][3]
|
||||
|
||||
在创建管理员用户时,请确保密码是 8 个字符,同时用户名为 admin,然后点击“Create User”。
|
||||
|
||||
接下来进入如下所示的页面,选中“Local”矩形框。
|
||||
|
||||
[![Connect-Portainer-Local-Docker][4]][5]
|
||||
|
||||
点击“Connect”,
|
||||
|
||||
可以看到 admin 用户的漂亮首页如下所示,
|
||||
|
||||
[![Portainer-io-Docker-Monitor-Dashboard][6]][7]
|
||||
|
||||
现在 Portainer 已经准备好运行和管理你的 Docker 容器了,同时也可用于容器监控。
|
||||
|
||||
### 在 Portainer 中管理容器镜像
|
||||
|
||||
[![Portainer-Endpoints][8]][9]
|
||||
|
||||
检查当前的状态,可以看到有两个容器已经在运行了,如果你创建另一个也会立即显示出来。
|
||||
|
||||
像下面这样,在命令行中启动一个或两个容器,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker run --name test -it debian
|
||||
Unable to find image 'debian:latest' locally
|
||||
latest: Pulling from library/debian
|
||||
e79bb959ec00: Pull complete
|
||||
Digest: sha256:724b0fbbda7fda6372ffed586670573c59e07a48c86d606bab05db118abe0ef5
|
||||
Status: Downloaded newer image for debian:latest
|
||||
root@linuxtechi:/#
|
||||
```
|
||||
|
||||
然后在 Portainer 页面中点击刷新按钮(会出现一条让你确认的消息,点击上面的“Continue”),就可以像下面高亮显示的一样看到 3 个容器了。
|
||||
|
||||
[![Portainer-io-new-container-image][10]][11]
|
||||
|
||||
点击上图中红圈圈出来的“containers”,下一个页面会显示“**Dashboard Endpoint summary** ”。
|
||||
|
||||
[![Portainer-io-Docker-Container-Dash][12]][13]
|
||||
|
||||
在这个页面中,点击上图高亮和红圈圈出来的“Containers”,就可以对容器进行监控了。
|
||||
|
||||
### 以简单的方式对容器进行监控
|
||||
|
||||
继续上面的步骤,就会出现一个如下所示精致、漂亮的“Container list”页面。
|
||||
|
||||
[![Portainer-Container-List][14]][15]
|
||||
|
||||
所有的容器都可以在这里进行控制(停止,启动等等)。
|
||||
|
||||
**1)** 在这个页面上,停止我们之前启动的“test”容器(这是一个我们早先启动的 debian 容器)
|
||||
|
||||
选中此容器前面的复选框,然后点击上面的“Stop”按钮来停止。
|
||||
|
||||
[![Stop-Container-Portainer-io-dashboard][16]][17]
|
||||
|
||||
在命令行中,你也会看到这个容器现在已经停止或退出了。
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo docker container ls -a
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
d45902e717c0 debian "bash" 21 minutes ago Exited (0) 49 seconds ago test
|
||||
08b96eddbae9 centos:7 "/bin/bash" About an hour ago Exited (137) 9 minutes ago mycontainer2
|
||||
35286de9f2e2 portainer/portainer "/portainer" 2 hours ago Up About an hour 0.0.0.0:9000->9000/tcp compassionate_benz
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
**2)** 现在,在 Portainer 页面中启动已经停止的两个容器(test 和 mycontainer2)
|
||||
|
||||
选中已停止的这两个容器前面的复选框,然后点击“Start”。
|
||||
|
||||
[![Start-Containers-Portainer-GUI][18]][19]
|
||||
|
||||
你会立即看到两条窗口提醒,内容是“容器成功启动”,并且两个容器的状态变为正在运行。
|
||||
|
||||
[![Conatiner-Started-successfully-Portainer-GUI][20]][21]
|
||||
|
||||
### 一步步探索其他多种选项和特性
|
||||
|
||||
**1)** 点击高亮的“Images”,你会看到如下页面
|
||||
|
||||
[![Docker-Container-Images-Portainer-GUI][22]][23]
|
||||
|
||||
这是可用的容器列表,其中一些可能没在运行。这些容器可以被导入、导出或者上传到不同的位置,截图如下所示。
|
||||
|
||||
[![Upload-Docker-Container-Image-Portainer-GUI][24]][25]
|
||||
|
||||
**2)** 点击高亮的“Volumes”,显示如下页面
|
||||
|
||||
[![Volume-list-Portainer-io-gui][26]][27]
|
||||
|
||||
**3)** 通过下面的操作,可以很容易的添加卷。点击添加卷按钮,出现如下页面
|
||||
|
||||
在名称输入框中输入卷名称,例如 “**myvol**”,然后点击 “**Create the volume**” 按钮。
|
||||
|
||||
[![Volume-Creation-Portainer-io-gui][28]][29]
|
||||
|
||||
新创建的卷如下所示(状态为未使用)。
|
||||
|
||||
[![Volume-unused-Portainer-io-gui][30]][31]
|
||||
|
||||
### 结论
|
||||
|
||||
通过上面的安装步骤,你可以到配置和使用 Portainer.io 的多种选项是多么简单和精美,它提供了用于构建和监控 Docker 容器的多种功能和选项。如前所述,这个一个非常轻量的工具,因此不会给主机系统增加任何负担。下一组选项将在本系列的第 2 部分中进行探讨。
|
||||
|
||||
另请阅读: **[用 Portainer.io (图形界面工具) 来监控和管理 Docker 容器 – 2][32]**
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/
|
||||
|
||||
作者:[Shashidhar Soppin][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[jlztan](https://github.com/jlztan)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linuxtechi.com/author/shashidhar/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linuxtechi.com/how-to-setup-docker-on-ubuntu-server-16-04/
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password-1024x681.jpg
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password.jpg
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker-1024x538.jpg
|
||||
[5]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker.jpg
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard-1024x544.jpg
|
||||
[7]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard.jpg
|
||||
[8]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints-1024x252.jpg
|
||||
[9]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints.jpg
|
||||
[10]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image-1024x544.jpg
|
||||
[11]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image.jpg
|
||||
[12]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash-1024x544.jpg
|
||||
[13]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash.jpg
|
||||
[14]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List-1024x538.jpg
|
||||
[15]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List.jpg
|
||||
[16]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard-1024x447.jpg
|
||||
[17]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard.jpg
|
||||
[18]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI-1024x449.jpg
|
||||
[19]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI.jpg
|
||||
[20]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI-1024x538.jpg
|
||||
[21]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI.jpg
|
||||
[22]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI-1024x544.jpg
|
||||
[23]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI.jpg
|
||||
[24]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI-1024x544.jpg
|
||||
[25]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI.jpg
|
||||
[26]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui-1024x544.jpg
|
||||
[27]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui.jpg
|
||||
[28]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui-1024x544.jpg
|
||||
[29]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui.jpg
|
||||
[30]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui-1024x544.jpg
|
||||
[31]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui.jpg
|
||||
[32]: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-io-part-2/
|
@ -0,0 +1,131 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "hom"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "Manage your SSH connections with this open source tool"
|
||||
[#]: via: "https://opensource.com/article/20/9/ssh-connection-manager"
|
||||
[#]: author: "Kenneth Aaron https://opensource.com/users/flyingrhino"
|
||||
|
||||
使用开源工具 `nccm` 管理 `SSH` 连接
|
||||
======
|
||||
使用 `nccm` 让你的终端连接更快,更稳定
|
||||
![Penguins][1]
|
||||
|
||||
`OpenSSH`很常用,但是仍然有其他的连接工具,因此我开发了 `nccm`来使运行进程更高效。 `nccm` 是一个使用标准终端接口(就像项目所命名的`ncurses`)的建议终端连接工具
|
||||
|
||||
### 安装 nccm
|
||||
|
||||
最简单的方式是从这个 [仓库][2]下载
|
||||
|
||||
|
||||
```
|
||||
`$ git clone https://github.com/flyingrhinonz/nccm nccm.git`
|
||||
```
|
||||
|
||||
在`nccm.git/nccm`的文件夹中有两个文件:`nccm`执行文件和`nccm.yml`配置文件
|
||||
|
||||
首先将执行文件`nccm`拷贝到系统目录`/usr/local/bin/`中并添加执行权限,也可以通过使用`install`命令来完成操作
|
||||
|
||||
|
||||
```
|
||||
$ sudo install -m755 nccm
|
||||
–target-directory /usr/local/bin
|
||||
```
|
||||
|
||||
配置文件`nccm.yml`可以拷贝到以下任意一个文件夹中,终端会默认从第一个顺序获取配置。
|
||||
|
||||
* `~/.config/nccm/nccm.yml`
|
||||
* `~/.nccm.yml`
|
||||
* `~/nccm.yml`
|
||||
* `/etc/nccm.yml`
|
||||
|
||||
|
||||
|
||||
`nccm`需要在`Python 3`的环境中运行,因此你的电脑需要事先安装`Python 3`,大部分的环境依赖在`Python 3`中默认安装了。以下是必须要安装的`YAML`依赖
|
||||
|
||||
如果为暗中`pip`,你需要使用包管理器来安装,然后安装`yamlinit`包来验证安装`nccm.yml`
|
||||
|
||||
在`Debian`或相似系统使用`apt`命令:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo apt install python3-pip yamllint`
|
||||
```
|
||||
|
||||
在`Fedora`或者相似系统使用`dnf`:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install python3-pip yamllint`
|
||||
```
|
||||
|
||||
`PyYAML`也是必须安装的,可以通过使用`pip`来安装
|
||||
|
||||
|
||||
```
|
||||
`$ pip3 install --user PyYAML`
|
||||
```
|
||||
|
||||
### 使用`nccm`
|
||||
|
||||
开始之前需要修改`nccm.yml`文件来添加终端连接配置,可以参照示例文件格式化`YAML`文件。仿照示例文件再开始行添加连接名称,文件使用两个空格缩进。不要忘了`YAML`的语言类型
|
||||
|
||||
不要担心你的终端登录信息以何顺序排列,`nccm`会提示用户如何排序
|
||||
|
||||
如果修改完成,可以使用`yamllint`来校验配置
|
||||
|
||||
|
||||
```
|
||||
`$ yamllint ~/.config/nccm/nccm.yml`
|
||||
```
|
||||
|
||||
如果没有错误信息返回,说明文件的内容格式是正确的,可以进行下面的步骤
|
||||
|
||||
如果`nccm`可以从 [环境变量][3] 中找到并且可以执行,由于`nccm`会加载 TUI 来执行界面操作,因此需要查看`Python3`的执行环境,依赖包是否正确安装,缺少任一依赖都会在命令行中展示出来
|
||||
|
||||
只要你没有在配置文件中更改`ncm_config_control mode`,你可以使用以下的键盘按键来控制
|
||||
|
||||
* 上/下方向键 - 移动光标
|
||||
* Home/End -跳转到文件开始和结尾
|
||||
* PgUp/PgDn - 以页为单位查看
|
||||
* 左/右 方向键 - 水平滚动
|
||||
* TAB - 在字块中移动
|
||||
* 回车 - 连接选中的终端
|
||||
* Ctrl-h -显示帮助菜单
|
||||
* Ctrl-q or Ctrl-c - 退出
|
||||
* F1-F5 or !@#$% - 在列(1-5)之间切换
|
||||
|
||||
|
||||
|
||||
使用`F1`到`F5`来切换列,如果你的设备`Fn`键冲突你可以使用`!@#$%`来替代。默认界面显示 4 列内容,但是可以通过将用户名和服务地址分隔开来显示 5 列。你也可以通过再次使用和第一次过滤相同的按键来切换显示,选中的行会高亮显示
|
||||
|
||||
![nccm screenshot terminal view][4]
|
||||
|
||||
在过滤条件中输入过滤内容,会将包含的内容过滤显示,过滤的关键词是大小写敏感的,字符中间的空格不是必须的。在`Conn`部分也是同样的输入限制,然后按回车键就可以选中所输入的序号配置
|
||||
|
||||
这个工具还有许多功能需要你去发掘,比如专注模式,这些部分留下等待你去探索,也可以查看项目主页或者内置的帮助文档查看更多细节内容
|
||||
|
||||
项目的`YAML`配置文件的文档是完善的,所以你可以查阅修改使你的终端工具使用起来更加顺手。`nccm`项目是非常希望得到你的反馈的,所以你可以 fork 该项目然后添加更多新功能,我们欢迎你的合并请求。
|
||||
|
||||
### 轻松使用 nccm来连接 SSH
|
||||
|
||||
我希望这个工具可以对您有用,感谢能够为开源工作增加自己的贡献,请接收`nccm`作为我对开源项目自由、高效工作所做的贡献
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/9/ssh-connection-manager
|
||||
|
||||
作者:[Kenneth Aaron][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[hom](https://github.com/hom)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/flyingrhino
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ "Penguins"
|
||||
[2]: https://github.com/flyingrhinonz/nccm
|
||||
[3]: https://opensource.com/article/17/6/set-path-linux
|
||||
[4]: https://opensource.com/sites/default/files/uploads/nccm_screenshot.png "nccm screenshot terminal view"
|
@ -0,0 +1,135 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux)
|
||||
[#]: via: (https://itsfoss.com/long-shutdown-linux/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
关机时间太长?下面是如何调查和解决 Linux 中关机时间过长的问题
|
||||
======
|
||||
|
||||
_**你的 Linux 系统关机时间太长么?以下是你可以采取的步骤,来找出导致延迟关机的原因并解决这个问题。**_
|
||||
|
||||
我希望你对 [sigterm 和 sigkill][1] 的概念有一点熟悉。
|
||||
|
||||
当你[关闭 Linux 系统][2]时,它会发送 sigterm,并礼貌地要求正在运行的进程停止。有些进程不符合该行为,它们会忽略 sigterm 并继续运行。
|
||||
|
||||
这可能会导致关机过程的延迟,因为你的系统会在一个预定义的时间段内等待运行的进程停止。在这个时间段之后,它会发送 kill 信号来强制停止所有剩余的运行进程并关闭系统。
|
||||
|
||||
事实上,在某些情况下,你会在黑屏上看到一个类似 “a stop job is running” 的信息。
|
||||
|
||||
如果你的系统关闭时间太长,你可以做以下工作:
|
||||
|
||||
* 检查哪个进程/服务耗时过长,以及你是否能删除或重新配置它,使其正常运行。
|
||||
* 更改系统强制停止运行进程前的默认等待时间。(快速而不优雅的方式)
|
||||
|
||||
|
||||
|
||||
我这里使用的是使用 systemd 的 Ubuntu。这里的命令和步骤适用于任何使用 systemd 的 Linux 发行版(大多数发行版都是这样)。
|
||||
|
||||
![][3]
|
||||
|
||||
### 检查哪些进程会导致 Linux 的长时间关机
|
||||
|
||||
如果你想找出问题所在,你应该检查上次关机时发生了什么。使用这个命令来获得“我知道你上个会话做了什么”(I Know What You Did Last Summer 的双关语)的力量。
|
||||
|
||||
```
|
||||
journalctl -rb -1
|
||||
```
|
||||
|
||||
[journalctl 命令][4]能让你读取系统日志。使用选项 “-b -1” 可以过滤最后一次启动会话的日志。使用选项 “-r” 时,日志将按时间倒序显示。
|
||||
|
||||
换句话说,“journalctl -rb -1” 命令将显示最后一次关闭 Linux 系统之前的系统日志。这里就是你需要分析 Linux 系统长时间关机问题的地方。
|
||||
|
||||
没有 journal 日志?下面是你应该做的。
|
||||
|
||||
如果没有 journal 日志,请确认你的发行版是否使用 systemd。
|
||||
|
||||
即使在一些使用 systemd 的 Linux 发行版上,journal 日志也没有被默认激活。
|
||||
|
||||
请确认 /var/log/journal 是否存在。如果不存在,请创建它:
|
||||
|
||||
```
|
||||
sudo mkdir /var/log/journal
|
||||
```
|
||||
|
||||
你还应该检查 /etc/systemd/journald.conf 文件的内容,并确保 Storage 的值被设置为自动或持久。
|
||||
|
||||
你是否在日志中发现可疑的东西?是否有一个进程/服务拒绝停止?如果是,调查一下是否可以在没有副作用的情况下删除它,或者是否可以重新配置它。请不要在这里盲目地去删除东西。你应该对这个进程有所了解。
|
||||
|
||||
### 通过减少默认停止超时来加快 Linux 中的关机速度(快速修复)
|
||||
|
||||
关机的默认等待时间通常设置为 90 秒。在这个时间之后,你的系统会尝试强制停止服务。
|
||||
|
||||
如果你想让你的 Linux 系统快速关闭,你可以改变这个等待时间。
|
||||
|
||||
你可以在位于 /etc/systemd/system.conf 的配置文件中找到所有的 systemd 设置。这个文件中应该有很多以 # 开头的行。它们代表了文件中各条目的默认值。
|
||||
|
||||
在开始之前,最好先复制一份原始文件。
|
||||
|
||||
```
|
||||
sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.orig
|
||||
```
|
||||
|
||||
在这里寻找 DefaultTimeoutStopSec。它可能被设置为 90 秒。
|
||||
|
||||
```
|
||||
#DefaultTimeoutStopSec=90s
|
||||
```
|
||||
|
||||
你得把这个值改成更方便的,比如 5 秒或 10 秒。
|
||||
|
||||
```
|
||||
DefaultTimeoutStopSec=5s
|
||||
```
|
||||
|
||||
如果你不知道如何在终端中编辑配置文件,可以使用这个命令在系统默认的文本编辑器(如 Gedit)中打开文件进行编辑:
|
||||
|
||||
```
|
||||
sudo xdg-open /etc/systemd/system.conf
|
||||
```
|
||||
|
||||
![Change Shutdown Time Settings Ubuntu][5]
|
||||
|
||||
不要忘记**删除 DefaultTimeoutStopSec 前的 # 号**。保存文件并重启系统。
|
||||
|
||||
这将帮助你减少 Linux 系统的关机延迟。
|
||||
|
||||
看门狗问题!
|
||||
|
||||
Linux 有一个名为看门狗的模块,用于监控某些服务是否在运行。它可以被配置为在系统因软件错误而挂起时自动重启系统。
|
||||
|
||||
在桌面系统上使用看门狗是不常见的,因为你可以手动关闭或重启系统。它经常被用于远程服务器上。
|
||||
|
||||
首先检查看门狗是否在运行:
|
||||
|
||||
```
|
||||
ps -af | grep watch*
|
||||
```
|
||||
|
||||
如果你的系统正在运行看门狗,你可以在 systemd 配置文件 /etc/systemd/system.conf 中将 ShutdownWatchdogSec的 值从 10 分钟改为更低的值。
|
||||
|
||||
**你能解决关机时间过长的问题吗?**
|
||||
|
||||
希望本教程能帮助你解决系统长时间关机的问题。如果你成功解决了这个问题,请在评论中告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/long-shutdown-linux/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://linuxhandbook.com/sigterm-vs-sigkill/
|
||||
[2]: https://itsfoss.com/schedule-shutdown-ubuntu/
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/troubleshoot-long-shutdown-linux.gif?resize=800%2C450&ssl=1
|
||||
[4]: https://linuxhandbook.com/journalctl-command/
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/change-shutdown-time-settings-ubuntu.png?resize=797%2C322&ssl=1
|
Loading…
Reference in New Issue
Block a user