Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果可以,永远不要在生产中直接运行 Node.js #5777

Conversation

fireairforce
Copy link
Contributor

你也许永远不要针对生产中的 Node.js 运行

译文翻译完成,resolve #5751

你也许永远不要针对生产中的 Node.js 运行
@fireairforce
Copy link
Contributor Author

差点翻译自闭了= =

@HearFishle
Copy link
Contributor

校对认领,希望不会自闭

@fanyijihua
Copy link
Collaborator

@HearFishle 好的呢 🍺

@sunui
Copy link
Contributor

sunui commented May 15, 2019

这标题是不是要再斟酌一下,run directly against Nodejs,我觉得意思是:直接靠/依托 Nodejs 运行(应用),against 这里应该不是 针对反对的意思吧,参考下~

@fireairforce
Copy link
Contributor Author

嗯嗯,其实这个标题我思考了很久。。。一直没想到合适的词,后来我结合了后面文章的内容,在内容里这样翻译我觉得还可以,然后标题也这么写的,我会好好考虑您的意见的。谢谢。

@fireairforce
Copy link
Contributor Author

标题我后续会修改的 = = ,我也觉得现在这个读上去没那么好 = =

@portandbridge
Copy link
Contributor

我也很好奇这个 against 是什么意思

@portandbridge
Copy link
Contributor

另外我想要提一点的是 in production 的词意

它如果是一个定语,修饰 node.js 的话,翻译就是和现在一样
它还有另外一个可能,就是起地点状语的作用,这时候它谈的是整个句子涉及的场合:在生产中不要干什么什么

哪个是对的要看译者根据文意判断

@portandbridge
Copy link
Contributor

译者你好。这篇文章太专业了我读不懂不敢校

Copy link
Contributor

@HearFishle HearFishle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这篇文章确实是很那个了。校对完成,译者可以自行斟酌。最好再找个大神校对一下。

> * 校对者:

# You should never ever run directly against Node.js in production. Maybe.
# 你也许永远不要针对生产中的 Node.js 运行
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果可以,永远不要在生产中直接运行 Node.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得这个肯定不是运行Node.js,因为你看后面的文章可以看到,作者使用Node.js在运行它的项目(比如pm2)。 = =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同意@HearFishle 的说法:永远不要在生产中直接运行 Node.js
同时,全文中其他地方也要进行修改。全文中其他地方也要进行修改。全文中其他地方也要进行修改。

文章讲的是直接用 npm run start 来直接运行 Node.js ,一旦某个方法挂了整个程序就挂了。然后就暗戳戳的说用 pm2 这种管理器来间接运行 Node.js 或者用 Azure 或者 Kubernetes 容器来监视间接运行。所以 直接 和 间接 是非常准确的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qaq,ok


![](https://cdn-images-1.medium.com/max/5120/1*Lh8JaRfiqPj9bTrd8a3xgQ.png)

Sometimes I wonder if I know much of anything at all.
有时候我想知道我是否知道很多东西。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有时候我也在想我是否真的知道很多东西。


There is a better diagram created by [Alicia Liu](https://medium.com/counter-intuition/overcoming-impostor-syndrome-bdae04e46ec5) that kind of changed my life. She says that it’s more like this…
[Alicia Liu](https://medium.com/counter-intuition/overcoming-impostor-syndrome-bdae04e46ec5) 创建了一个更好的图表,改变了我的生活。她说这更像是。。。。。。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不清楚放这么多句号是否符合掘金的规范,译者自己考虑吧。


![](https://cdn-images-1.medium.com/max/2000/1*N7vv39ri9yC0l6krsSFlQA.png)

I love this diagram so much because I want it to be true. I don’t want to spend the rest of my life as a tiny, shrinking blue dot of insignificance.
我非常喜欢这个图表,因为我希望它是真实的。我不想把余生都花在一个微不足道的萎缩蓝点上。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我不想把余生都花在一个微不足道的萎缩蓝点上。=>我不想把余生都过得像一个微不足道的萎缩蓝点一样。


SO DRAMATIC. Blame Pandora. I don’t control what gets played next while I’m writing this article and [Dashboard Confessional](https://www.youtube.com/watch?v=ixG3DgrPC3c) is a helluva drug.
太戏剧化了。怪潘多拉。当我写这篇文章的时候,我无法控制接下来要发生什么。而 [Dashboard Confessional](https://www.youtube.com/watch?v=ixG3DgrPC3c)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

而 [Dashboard Confessional]。后面缺了。目测可以翻译成:而 [Dashboard Confessional]真是一副毒药。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方打漏了 = =


The main reason is that you shouldn’t use Node to monitor Node. You don’t want to use the thing that you are monitoring to monitor that thing. It’s kind of like you asking my teenage son to supervise himself on a Friday night: Will that end badly? It might, and it might not. But you’re about to find out the hard way.
主要原因是不应该使用 Node 来监视 Node。你不想用你正在监视的东西来监视那个东西。就像你在周五晚上让我十几岁的儿子监督他自己一样:结果会很糟糕吗?可能,也可能不会。但你要找出困难的方法。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能,也可能不会。但你要找出困难的方法=>可能会,也可能不会。


Tierney recommends that you not have a Node process manager running your application at all. Instead, have something at a higher level which watches multiple separate instances of your application. For example, an ideal setup would be if you had a Kubernetes cluster with your app running on separate containers. Kubernetes can then monitor those containers and if any of them go down, it can bring them back and report on their health.
Tierney 建议你不要使用 Node 进程管理器来运行应用程序的。相反,在更高级别上有一些东西可以监视应用程序的多个单独实例。例如,一个理想的设置是,如果你有一个 Kubernetes 集群,你的应用程序在不同的容器上运行。然后 Kubernetes 可以监控这些容器,如果其中任何容器发生故障,它可以将它们带回来并报告它们的健康状况。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去掉第一句的“的”。它可以将它们带回来并报告它们的健康状况。=>它可以将它们恢复并且报告健康状况。


![](https://cdn-images-1.medium.com/max/2560/1*YSvtZOR4DIt1McSdDChVew.png)

But you still only have one instance here. It takes the container a second to come back online after it crashes meaning that there could be a few seconds of downtime for your users.
但这里仍然只有一个实例。容器崩溃后需要一秒钟才能重新联机,这意味着你的用户可能需要几秒钟的停机时间。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这意味着你的用户可能需要几秒钟的停机时间=>这意味着你的用户可能会有几秒钟的停机时间。


Ideally, you would want more than one container running. The solution to this would be to deploy multiple instances of your application to multiple Azure AppService sites and then use Azure Front Door to load balance the apps behind a single IP address. Front Door will know when a container is down and will route traffic to other healthy instances of your application.
理想情况下,你需要运行多个容器。解决方案是将应用程序的多个实例部署到多个 Azure AppService 站点,然后使用 Azure Front Door 在单个 IP 地址后面对应用程序进行负载均衡。Front Door将知道容器何时关闭,并且将流量路由到应用程序的其他健康实例。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要=>希望。后面=>下


### systemd

Another suggestion that Tierney had is to run Node with `systemd`. I don’t understand too much (or anything at all) about `systemd` and I’ve already messed this phrasing up once already, so I’ll let Tierney say it in his own words…
Tierney 的另一个建议是使用 `systemd` 运行 Node。我不是很了解(或者说根本不知道) `systemd`,我已经把这句话搞砸过一次了,所以我会让 Tierney 用他自己的话说出来。。。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搞砸=>弄错

@fireairforce
Copy link
Contributor Author

译者你好。这篇文章太专业了我读不懂不敢校

哈哈,没事儿,我翻译水平比较菜 = =,多谢大佬几次帮我校对啦

@JasonLinkinBright
Copy link

校对认领

@fanyijihua
Copy link
Collaborator

@JasonLinkinBright 妥妥哒 🍻

Copy link

@JasonLinkinBright JasonLinkinBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

校对完成


If I was to draw a Venn Diagram of what I know vs what I feel like everyone else knows, it would look like this…
如果我要绘制一个维恩图来表示我所知道的和其他人都知道的东西,它看起来就像这样:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果我要绘制一个维恩图来表示我所知道的和其他人都知道的东西

如果绘制一个维恩图来表示我所知道的和其他人都知道的东西。这边去掉 “我要” 或者改成”让我“会不会好一点


There is a better diagram created by [Alicia Liu](https://medium.com/counter-intuition/overcoming-impostor-syndrome-bdae04e46ec5) that kind of changed my life. She says that it’s more like this…
[Alicia Liu](https://medium.com/counter-intuition/overcoming-impostor-syndrome-bdae04e46ec5) 创建了一个更好的图表,改变了我的生活。她说这更像是。。。。。。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

她说这更像是

她说这种情况更像是


Well, assuming that Alicia’s diagram is true, I would like to share with you what I **now** know about running Node apps in production. Perhaps our relative Venn Diagrams don’t overlap on this subject.
好吧,假设Alicia的图表是真的,我想与大家分享一下我**现在**对在生产中运行 Node 应用程序的了解。也许我们的相对维恩图不会在这个问题上重叠。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好吧,假设Alicia的图表是真的
好吧,假设 Alicia 的图表是真的(中英空格)


Well, assuming that Alicia’s diagram is true, I would like to share with you what I **now** know about running Node apps in production. Perhaps our relative Venn Diagrams don’t overlap on this subject.
好吧,假设Alicia的图表是真的,我想与大家分享一下我**现在**对在生产中运行 Node 应用程序的了解。也许我们的相对维恩图不会在这个问题上重叠。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我想与大家分享一下我现在对在生产中运行 Node 应用程序的了解。
我想与大家分享一下我现在对在生产中运行 Node 应用程序的一些认识。


Maybe. But maybe not. Let’s talk about the reasoning behind this statement. First, let’s look at why not.
也许。但可能也不是。让我们来谈谈这个声明背后的原因。首先,让我们看看为什么不能。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

让我们来谈谈这个声明背后的原因。首先,让我们看看为什么不能。
我们一起来探讨下这个说法是怎么得到的。


[**Azure Front Door Service | Microsoft Azure**](https://azure.microsoft.com/en-us/services/frontdoor/?WT.mc_id=medium-blog-buhollan)
[Deliver, protect and track the performance of your globally distributed microservice applications with Azure Front Door](https://azure.microsoft.com/en-us/services/frontdoor/?WT.mc_id=medium-blog-buhollan)
[使用Azure Front Door 交付,保护和跟踪全球分布式微服务应用程序的性能。。。](https://azure.microsoft.com/en-us/services/frontdoor/?WT.mc_id=medium-blog-buhollan)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用 Azure Front Door 交付,保护和跟踪全球分布式微服务应用程序的性能。]

依然是空格和句号问题

[**Running Your Node.js App With Systemd - Part 1**](https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/)
[You've written the next great application, in Node, and you are ready to unleash it upon the world. Which means you can…](https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/)
[**使用 Systemd 运行 Node.js 应用程序 —— 第一部分**](https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/)
[你已经在 Node 中编写了下一个很棒的应用程序,并且你已经准备发布它。这意味着你可以。。。](https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句号真的可以改成省略号了


Tierney also wants you to know that Worker Threads are coming in Node. This will allow you to start your app on multiple “workers” (threads) thusly negating the need for something like pm2. Maybe. I don’t know. I didn’t really read the article.
Tierney 还希望你知道 Node 中有工作线程,这可以让你在多个线程上启动你的应用程序,从而无需像 pm2 这样的东西。也许吧。我不知道,我没看过这篇文章。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也许吧。我不知道,我没看过这篇文章。

也许真的有工作线程吧,但我没看过相关的文章。


### The tiny circle abides
### 小圆圈住了

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

小圆圈住了

小圆圈永驻

> * 校对者:

# You should never ever run directly against Node.js in production. Maybe.
# 你也许永远不要针对生产中的 Node.js 运行

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同意@HearFishle 的说法:永远不要在生产中直接运行 Node.js
同时,全文中其他地方也要进行修改。全文中其他地方也要进行修改。全文中其他地方也要进行修改。

文章讲的是直接用 npm run start 来直接运行 Node.js ,一旦某个方法挂了整个程序就挂了。然后就暗戳戳的说用 pm2 这种管理器来间接运行 Node.js 或者用 Azure 或者 Kubernetes 容器来监视间接运行。所以 直接 和 间接 是非常准确的。

@JasonLinkinBright
Copy link

原文作者也太逗比了吧,摊手
初看时,笑死我了!
校对时,我自闭了...

@fireairforce
Copy link
Contributor Author

谢谢两位大佬的校验.@JasonLinkinBright,@HearFishle,辛苦了,很感谢.
@leviding 校验完成

@fireairforce fireairforce changed the title 你也许永远不要针对生产中的 Node.js 运行 如果可以,永远不要在生产中直接运行 Node.js May 16, 2019

# You should never ever run directly against Node.js in production. Maybe.
# 如果可以,永远不要在生产中直接运行 Node.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

忽然又感觉这个maybe的意思就是作者也不确定的意思。不过这个作者真的是点点烦。建议译者再斟酌一下,或者改回去。感觉这个如果可以好像并不合适。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看了下原文,作者好像是在别人口中听到这句话。然后就开始写文章探究这句话说得对不对。

这样的话,或许题目的意思是说 “(听说)千万不要在生产中______ Node.js。也有点道理吧”

@fireairforce
Copy link
Contributor Author

我觉得这个标题,至少作为读者能读懂,前面那个标题有点意思模糊。

另外,我觉得作者写这篇文章,有一种“我是谁,我在哪里,我在干嘛”的既视感。

@HearFishle
Copy link
Contributor

我觉得这个标题,至少作为读者能读懂,前面那个标题有点意思模糊。
另外,我觉得作者写这篇文章,有一种“我是谁,我在哪里,我在干嘛”的既视感。

对,让我们一起吐槽原作者,这么写文章是不合适的。

@JasonLinkinBright
Copy link

我觉得这个标题,至少作为读者能读懂,前面那个标题有点意思模糊。
另外,我觉得作者写这篇文章,有一种“我是谁,我在哪里,我在干嘛”的既视感。

对,让我们一起吐槽原作者,这么写文章是不合适的。

这篇真的还蛮奇怪的,讲的是 pm2 然后扯了一大堆别的东西

@leviding
Copy link
Member

我觉得这个标题,至少作为读者能读懂,前面那个标题有点意思模糊。
另外,我觉得作者写这篇文章,有一种“我是谁,我在哪里,我在干嘛”的既视感。

对,让我们一起吐槽原作者,这么写文章是不合适的。

这篇真的还蛮奇怪的,讲的是 pm2 然后扯了一大堆别的东西

那就是选文章的问题了 🤣 我这的锅,欢迎大家推荐文章啊

@leviding leviding added the enhancement 等待译者修改 label May 17, 2019
@fireairforce
Copy link
Contributor Author

@leviding 这个我已经修改完了啊= = ....

@leviding leviding added 标注 待管理员 Review and removed enhancement 等待译者修改 labels May 17, 2019
@leviding leviding merged commit 06b1255 into xitu:master May 17, 2019
@leviding
Copy link
Member

@fireairforce 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。

文章发布时,标题前面那个大图,你可以在上传掘金的时候作为题图使用,然后在文中删除那个图就行啦。

掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件
专栏地址:https://zhuanlan.zhihu.com/juejinfanyi

@leviding leviding added 翻译完成 and removed 标注 待管理员 Review 正在校对 labels May 17, 2019
@fireairforce
Copy link
Contributor Author

@fireairforce 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。

文章发布时,标题前面那个大图,你可以在上传掘金的时候作为题图使用,然后在文中删除那个图就行啦。

掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件
专栏地址:https://zhuanlan.zhihu.com/juejinfanyi

好的,已经按照需求发布啦。
链接地址为:https://juejin.im/post/5cdeb1306fb9a07efd46dbe5

@fireairforce fireairforce deleted the translation/you-should-never-ever-run-directly-against-node-js-in-production-maybe.md branch June 2, 2019 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

你也许永远不要针对生产中的 Node.js 运行
7 participants