kafka 命令重新启动_命令行基础知识:关闭和重新启动
kafka 命令重新啟動
When you’re in the same room as a server, shutting it down or rebooting it is simple. You could hold the power button or even unplug the whole machine. Not only are these solutions inelegant, they have the potential to corrupt your data and potentially damage your hardware! They also don’t work when you’re logged into your favorite remote server.
當您與服務器位于同一房間時,關閉或重新啟動它很簡單。 您可以按住電源按鈕,甚至拔下整個機器的電源。 這些解決方案不僅笨拙,而且還可能破壞您的數據并可能損壞您的硬件! 當您登錄到喜歡的遠程服務器時,它們也不起作用。
Depending on your hosting provider, you very well may have a nice GUI interface at your disposal, completely with a shiny red button to shutdown or reboot the machine. It’s a sufficient solution, but doesn’t necessarily scale across different hosting providers.
根據主機提供商的不同,您可能會擁有一個不錯的GUI界面,完全帶有一個閃亮的紅色按鈕來關閉或重新啟動計算機。 這是一個足夠的解決方案,但不一定跨不同的托管服務提供商擴展。
Knowing how to do things on the command-line allows you to be as stack agnostic as possible. You can switch easily between hosting providers and always have the same consistent set of tools at your disposal. This flexibility comes in extra handy when you’re working with a brand new stack that you’re not familiar with.
知道如何在命令行上執行操作可以使您盡可能地與堆棧無關。 您可以在托管服務提供商之間輕松切換,并始終擁有相同的一致工具集。 當您使用不熟悉的全新堆棧時,這種靈活性特別方便。
入門 (Getting started)
The commands discussed in this article, shutdown and reboot do exactly as their names imply. They will shut down or reboot your machine. Because these are somewhat destructive commands, if you run them locally, be ready for your system to system to shut down or reboot.
本文討論的命令, shutdown和reboot與它們的名稱所暗示的完全相同。 他們將關閉或重新啟動計算機。 因為這些命令具有破壞性,所以如果在本地運行它們,請準備好使系統關閉或重新引導。
Using a remote development or staging server running a Unix-like operating system (like Linux) would be an ideal scenario. Because you will in fact take your server off line with these commands, I wouldn’t recommend running them on a production server unless you really want to reboot the box.
使用運行類似Unix操作系統(例如Linux)的遠程開發或登臺服務器將是理想的方案。 因為實際上您將使服務器與這些命令脫鉤,所以除非您確實要重新啟動該框,否則我建議您不要在生產服務器上運行它們。
The following commands will more than likely require elevated super-user privileges to run. If you receive an error about a command not being found, just try it again with sudo.
以下命令很可能需要提升的超級用戶特權才能運行。 如果收到關于找不到命令的錯誤,請使用sudo再次嘗試。
If you don’t have super-user privilege on the machine you’re on, you more than likely won’t be able to shut it down or reboot it.
如果您所在的計算機沒有超級用戶特權,則很有可能將其關閉或重新啟動。
關機 (Shutting down)
Shutting down a system can be done with the shutdown command, in it’s simplest form, without any arguments:
可以使用shutdown命令以最簡單的形式關閉系統,而無需任何參數:
$ shutdown # Graceful shutdown in 1 minuteWithout any arguments, the shutdown command will schedule the shutdown for a minute out from the current time. Because it’s scheduled in the future, you have a window of opportunity to cancel the shutdown by way of the -c argument:
如果不帶任何參數, shutdown命令將安排關機時間比當前時間晚一分鐘。 因為它是將來計劃的,所以您有機會通過-c參數取消關閉:
$ shutdown -c # Cancel a scheduled shutdownCrisis averted!
避免危機!
You may have noticed that a broadcast message was issued when you ran the first shutdown command. That’s the wall message, and it’s issued to all of the users that are currently logged into the system.
您可能已經注意到,當您運行第一個shutdown命令時,發出了一條廣播消息。 這是墻壁消息,它會發給當前登錄到系統的所有用戶。
The time of the shutdown can be scheduled, as well as the content of the wall message that is presented to your users:
可以安排關閉時間以及顯示給您的用戶的掛墻消息的內容:
$ shutdown now "Cya later alligator" # Immediately shut down $ shutdown +5 "Cya later alligator" # Shutdown in 5 minutesBecause the arguments are passed in order and without additional --flags to indicate what the values are, they must be passed in a specific order. That means you can’t customize the wall message without also specifying a time.
因為參數是按順序傳遞的,并且沒有附加的--flags來指示值是什么,所以必須按特定的順序傳遞它們。 這意味著您不能在不指定時間的情況下自定義留言。
重新啟動 (Rebooting)
If you are just looking for a quick and easy way to reboot a server, the reboot command is about as easy as it comes:
如果您只是在尋找一種快速輕松地重啟服務器的方法,那么reboot命令就和它一樣簡單:
$ reboot # Graceful restart $ reboot -f # Forceful, like holding the power buttonIn tune with the Unix Philosophy, the reboot command does what it’s name implies and not much else.
與Unix Philosophy協調 , reboot命令執行了其名稱所隱含的內容,僅此而已。
The shutdown command on the other hand, actually does a bit more than the “shutdown” name infers, by allowing you to use it to reboot a machine as well as shut it down.
另一方面, shutdown命令實際上比“ shutdown”名稱推斷的功能要多得多,它允許您使用它來重新啟動計算機以及將其關閉。
Why this is important is that while the reboot command is quick and gets the job done, using the shutdown command to restart your machine gives you the added benefit of being able to schedule things as well as edit the wall message.
之所以如此重要,是因為盡管reboot命令很快并且可以完成工作,但是使用shutdown命令重新啟動計算機可以為您帶來更多好處,使您能夠安排工作以及編輯留言。
To tell the shutdown command to reboot instead of just shutting down, pass in the -r or --reboot argument, along with any other options:
要告訴shutdown命令重新啟動而不只是關閉,請傳遞-r或--reboot參數以及任何其他選項:
$ shutdown --reboot # Reboot in 1 minute $ shutdown -r now "After while crocodile" # Immediately reboot $ shutdown -r +5 "After while crocodile" # Reboot in 5 minutesSimilar to how we canceled a full shutdown earlier, another added benefit over reboot is that you can also cancel a reboot via shutdown by calling it again with the -c argument:
與我們之前取消完全關閉的方式類似,與reboot ,另一個額外的好處是,您還可以通過使用-c參數再次調用重新啟動來通過shutdown來取消重新啟動:
$ shutdown -c # Cancel a scheduled shutdown (or reboot!)翻譯自: https://www.digitalocean.com/community/tutorials/workflow-command-line-basics-shutdown-reboot
kafka 命令重新啟動
總結
以上是生活随笔為你收集整理的kafka 命令重新启动_命令行基础知识:关闭和重新启动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [XJTUSE编译原理] 第三章 上下文
- 下一篇: 炒股高手必备抓大牛主图筹码箱体分析指标