从 Linux 迁移到 OpenSolaris 有多痛苦?
我们有一个业务应用程序,基本上运行在独立于操作系统的堆栈(tomcat+java+mysql)上,但我们始终在 redhat 或 centos 上运行它。
有一位客户出于自己的原因坚持在 opensolaris 上运行它(与 Sun 签订了昂贵的包含所有内容的支持协议)。
这样的迁移有多痛苦? 我们有很多配置文件和支持脚本,例如:
- apache
- apache/tomcat 连接器
- 与 postfix
- 自定义服务的电子邮件交互 启动/停止
- 几个 cron 作业(备份、监控)
- 不同的用户和权限(java、mysql、电子邮件、备份) ..)
我们的构建过程输出一个 .tar.gz 文件,其中包含我们的业务代码 + 一些编辑所有操作系统配置文件的 shell 脚本。
以前有过这方面的经验吗?
We have a business application that basically runs on an os-independent stack (tomcat+java+mysql) but we have always run it redhat or centos.
There is a customer that is insisting to run it on opensolaris for his own reasons (an expensive everything-is-included support agreement with Sun).
How painful can such a migration be? We have a lot of configuration file and support scripts such as:
- apache
- apache/tomcat connector
- email interaction with postfix
- customized service start/stop
- a couple of cron jobs (backup, monitoring)
- different users and permissions (java, mysql, email, backup...)
Our build process outputs a .tar.gz file with our business code + some shell scripts that edit all the os-configuration files.
Any previous experience on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
最大的问题在于您所使用的 Linux 上提供的 GNU 工具的非 POSIX(非标准)选项,这些选项不在 Solaris 标准命令中。 您可能会认为从 GNU 集中移植相关工具比修改系统更简单。 如果您在代码中添加了命令的绝对路径名 (
/usr/bin/ls
),但您决定使用 GNU 版本,则必须找到一种方法来修复这些问题。 我对于用 GNU 版本替换 OpenSolaris 版本会非常谨慎; 你不知道什么时候会破坏系统所依赖的东西。 因此,您可以将 GNU 命令放在一个单独的目录中 - 可能不是/usr/local
因为这是供机器所有者填充的,而不是供您作为应用程序销售者 - 并安排它用于代替系统命令。 (注意:在 Solaris 上,/bin
是到/usr/bin
的符号链接;我认为 OpenSolaris 也是如此。) AFAIK,Postfix 不是 OpenSolaris 上的标准,所以你必须确保你也安装了它。所有这些都是可行的——没有什么是不可克服的。 但很大程度上取决于您的代码库。
The biggest issues will be with the non-POSIX (non-standard) options you've used to the GNU tools provided on Linux that are not in the Solaris standard commands. You might decide that porting the relevant tools from the GNU set is simpler than modifying your system. If you've laced the code with absolute pathnames for commands (
/usr/bin/ls
) but you decide to use the GNU versions instead, you've got to find a way of fixing those. I'd be extremely cautious about replacing the OpenSolaris versions with the GNU versions; you don't know when you would break something that the system relies on. So, you would put the GNU commands in a separate directory - probably not/usr/local
because that is for the machine owners to populate, not you as an application-monger - and arrange for that to be used in place of the system commands. (Note: on Solaris,/bin
is a symlink to/usr/bin
; I assume the same is true of OpenSolaris.) AFAIK, Postfix is not standard on OpenSolaris, so you'd have to ensure you get that installed, too.All of this is doable - there's nothing insuperable. But a lot depends on your code base.
我们运行两者,但我们不使用 OpenSolaris 作为 Web 服务器。
好处是:
OpenSolaris 附带了 gnu 工具,因此,只要你的路径正确就可以了。
大多数事情都可以正常构建和运行。
不太好的地方:
确保您已经安装并正在使用 bash。 否则,您正在使用的所有那些您认为自己没有使用过的 bashism 都会让您烦恼。
确保您没有使用 /usr/bin 或 /bin 的硬编码路径。 这些工具不是 GNU 工具,因此有不同的选项。 如上所述使用 /usr/gnu。
您没有像使用 yum 或 apt 那样可以直接安装大量软件包。 是的,你有一个包管理器,只是填充得不够多。
因此,您可能需要手动安装软件包。 他们应该安装,这对您的系统管理员来说只是多了一点工作。
您确定 OpenSolaris 在您的硬件上运行良好吗? 值得检查一下。 您可能会发现某些硬件驱动程序没有经过充分测试。
除此之外,我们发现 OpenSolaris 很好。 它有很多好主意。
你看过 Nexenta - http://www.nexenta.org/os 它是 OpenSolaris 内核Ubuntu 用户区。
We run both, though we don't use OpenSolaris as a web servers.
The good:
OpenSolaris comes with the gnu tools, so, get your path right and that's ok.
Most things just build and run just fine.
The not so good:
Make sure that you've installed and are using bash. Otherwise all those bashisms that you are using that you didn't think you were using will bite you.
Make sure that you're not using hard coded paths to /usr/bin or /bin. These tools are not the GNU ones and therefore have different options. Use /usr/gnu as mentioned above.
You don't have the huge number of packages that you can install straight off as you do with yum or apt. Yes, you have a package manager, it's just not quite so well populated.
As a result you probably will be installing packages by hand. They should install, it's just a bit more work for your system admins.
Are you sure that OpenSolaris runs well on your hardware? It's worth a check. You might find that some of the hardware drivers aren't as well tested.
Otherwise we find OpenSolaris to be nice. It has a lot of good ideas.
Have you looked at Nexenta - http://www.nexenta.org/os It's the OpenSolaris kernel with a Ubuntu userland.
OpenSolaris 已经包含了所有 GNU 实用程序,只需将您的脚本指向 /usr/gnu/bin
安装 Postfix 应该不会出现任何问题,并且 Apache/MySQL 存在于基本 OpenSolaris 安装中(事实上,Cool Web Stack 的东西使得它成为可能)与 WAMP/Instant Rails 一样易于管理)。 除此之外,SMF 清单(SMF 是 rc 脚本的替代品,有点像 OSX 的 launchd,尽管您仍然可以使用常规的 init 脚本)可能会让您的生活更轻松,因为指定依赖项和运行顺序会更好一些(它将递归地启动/也停止所有相关服务)。
Tomcat 当然可以工作,尽管我认识的 OpenSolaris 上的每个人都使用 GlassFish。 YMMV,但是部署 .war 在任何地方都几乎相同。
部署到 LX 品牌区域(考虑 FreeBSD 监狱或 Linux vServer 进行比较)可能不是一个糟糕的第一步,因为 LX 品牌区域可以运行 Linux 二进制文件,并且明确基于 CentOS/RHEL。
除此之外,OpenSolaris 是自 b77 或其他版本以来的 Xen dom0,如果可以选择的话,将 CentOS/RHEL 放入 domU 中非常简单。
您还可以获得所有 Solaris 的好处(DTrace、ZFS、网络虚拟化 [通过 CrossBow] 等)。 谁知道? 你甚至可能会喜欢它! Java 就是 Java,所以这不会造成任何问题。
OpenSolaris includes all the GNU utilities already, just point your scripts at /usr/gnu/bin
Installing Postfix shouldn't present any problems, and Apache/MySQL are present in a base OpenSolaris install (in truth, the Cool Web Stack stuff makes it about as easy to administer as WAMP/Instant Rails). Beyond which, SMF manifests (SMF is a replacement for rc scripts sort of like OSX's launchd, though you can still use regular init scripts) may make your life easier, since specifying dependencies and run order is somewhat nicer (it'll recursively start/stop all dependent services also).
Tomcat certainly works, though everybody I know on OpenSolaris uses GlassFish. YMMV, but deploying a .war is pretty much the same everywhere.
It may not be a bad first step to deploy into a LX branded zone (think FreeBSD jails or Linux vServer for a comparison), as the LX branded zones can run Linux binaries, and are explicitly CentOS/RHEL based.
Other than that, OpenSolaris is a Xen dom0 since b77 or something, and putting CentOS/RHEL into a domU is dead simple, if that's an option.
You also get all the Solaris goodies along with it (DTrace, ZFS, network virtualization [via CrossBow], etc). Who knows? You may even like it! Java is Java, so that shouldn't pose any issues.
您可能需要重写大部分脚本(用户创建、服务启动),因为它在 CentOS 和 OpenSolaris 中可能有所不同。
如前所述,请您的客户安装 GNU 工具,以便您可以减少重写脚本的工作量。
如前所述
操作系统配置文件的格式也可能不同,您需要检查。
你的 tar.gz 文件应该可以毫无问题地提取,但是如果你使用 GNU 工具,你就会少一些意外。 某些 unix 操作系统的 tar 有一些限制
(可能有点题外话)
我们将 java/tomcat/postgresql/unix 应用程序与脚本中引用的所有二进制文件一起打包和分发。 这意味着我们支持的每个操作系统都有 1 个构建系统,这意味着我们支持我们的应用程序,也支持外部二进制文件,但最终我们不会给客户带来不好的惊喜。
我们还要求他们在安装应用程序之前执行所有 root 操作(用户创建、目录创建、sendmail 配置、系统调整)。
我们已经为所有受支持的操作系统编写了关闭/启动脚本,并且它们的安装是我们在客户计算机上以 root 身份执行的唯一操作。
you'll probably have to rewrite a big part of your scripts (user creations, service launch) as it is probably different in CentOS and OpenSolaris.
as previously written, ask your customer to install the GNU tools so you'll have less work to rewrite your scripts.
os configuration files may also not be in the same format, you'll need to check.
your tar.gz file should be extractable without troubles, but again you will have less surprises if you use GNU tools. some unix OS have tar with some limitations
(maybe a little offtopic)
we package and distribute our java/tomcat/postgresql/unix application with all binaries referenced in our scripts. this implies to have 1 build system for each OS we support, this implie we support our application but also external binaries, but in the end we do not have bad surprises @ customers.
we also ask them to do all root operations (user creation, directory creation, sendmail config, system tuning) before we install the application.
we have written shutdown / startup scripts for all supported OS, and their installation is the only thing we do in root on the customer machine.
除了你是一个巨魔这一事实之外,上面有人刚刚说过(开放)Solaris 有:
- ZFS
- DTrace
我们可以理解您担心失去 RHCE 工作,但您再次向我证明,我作为雇主在面试人员时忽略所有认证的决定是一个好的决定。 看起来,很大一部分这样的人(尤其是在微软世界)并不是那么……开放的,说得好听一点。
问候,
亚历克斯
Beside the fact that you're a troll, somebody just said above that (Open)Solaris has:
- ZFS
- DTrace
We can understand that you are afraid of not losing your RHCE job, but you just proved me once again that my decision as an employer to ignore all the certifications when interviewing people was a good one. It seems that a large percentage of such people (especially in the Microsoft world) are not so... open-minded, to put it nicely.
Regards,
Alex