Freud's Blog

Stay hungry, stay foolish. 少年辛苦终身事,莫向光阴惰寸功。

Websphere Application Server(07)--WAS Liberty介绍和使用

Posted on By Freud Kang

1. 什么是WAS Liberty

WebSphere Liberty is a comprehensive, flexible and secure Java EE and MicroProfile application server for modernizing and building the next era of applications and cloud-native services

IBM WebSphere® Liberty is a Java™ EE application server with a low-overhead Java runtime environment designed for cloud-native applications and microservices. WebSphere Liberty was created to be highly composable, start fast, use less memory, and scale easily. The Total Economic Impact study from Forrester Research shows that Liberty can increase developer productivity, simplify administration and maximize infrastructure utilization.

2. 简单介绍

  • 从was v8.5开始,每一个发行版中都会包含liberty profile.
  • 从was v8.5.5,liberty core发行了一个新版本,跟之前的有一些不同,重点是支持集群了.
  • 现在可以免费试用liberty profile的几中情况:
  • 开发环境或者小规模的产品环境
  • 在组织规模内部的测试或者产品环境中,最高2GB of JVM heap空间

3. 下载安装

https://www.ibm.com/cloud/websphere-liberty

4. 解压目录下各个目录的作用

  • bin目录下
    • ./server是用来create,start,stop, run, package, or create dumps of the liberty server
      • server dump
      • server javadump
    • ./securityUtility: Used to encode passwords included in server.xml configurations and to create a default certification for use during a server configuration.
    • ./featureManager: Used to install a feature package as a subsystem archive (esa) and generate an XML list of all features included in this installation of Liberty.
    • ./productInfo: Provides a list of all features included in this installation of Liberty.
    • ./binaryLog: Used to view or copy the contents of a binary logging repository, or list the available server process instances in the repository.
    • ./configUtility: Used to download configuration snippets from the IBM WebSphere Liberty Repository and to replace configuration snippet variables with your input values.
    • ./installUtility: Used to install assets in your Liberty profile environment and view required asset information.
    • ./isadc: Used to run the IBM® Support Assistant Data Collector for IBM WebSphere® Application Server, a tool that you can run to gather data from your Liberty server system for problem determination purposes.
  • etc目录:可选目录,定制化Liberty用的目录,有jvm.options和server.env文件
    • jvm.options: Used to customize default JVM runtime parameters
    • server.env: Used to configure default Liberty server environment variables
  • usr目录: By default, this directory contains server instances with their configuration inside a servers directory, applications, and any resources that can be shared between servers inside the shared directory.
  • usr/servers/
    • dropins: This directory is created by default and is automatically monitored. If you drop an application into this directory, the application is automatically deployed on the server.
      • ${server.config.dir}/dropins/myApp.war
      • ${server.config.dir}/dropins/myApp.war/WEB-INF/…
      • ${server.config.dir}/dropins/war/myApp/WEB-INF/…
    • configDropins: 不常用,有configDropins/defaults和configDropins/overrides两个目录
      • configDropins/defaults: 提供默认值,会在server cofiguration之前加载
      • configDropins/overrides: 最终配置值,会覆盖掉mian server.xml的配置值。
    • resources: This directory contains additional resources for the Liberty server instance. For example, keystores generated by the Liberty server are located at this directory.

5. 配置文件

  • server.xml : The primary configuration file for the Liberty server. This file is the one non-optional configuration file. It has a simple XML format that is suitable for text editors.
  • bootstrap.properties : An optional text file used to customize the kernel bootstrap process or to specify additional variables for use in server.xml.
  • jvm.options : An optional file used to specify JVM options for the server. If this file is present, it supersedes the jvm.options file in the /etc directory (only one file is used).
  • server.env : An optional file used to customize environment variables used to launch the server. If both this file and the /etc/server.env file are present, the contents of both are merged together with values specific to the server superseding values specified for the installation.

6. Features

liberty的asset和feature是可以从远程Repository安装的

  • LARS(Liberty Asset Repository Service)的默认远程Repository是
    • public.dhe.ibm.com on port 443
    • asset-websphere.ibm.com on port 443
  • 可以自己在本地搭建一个LARS
  • 也可以在本地设置一个Directory-Based Repository
  • 可以修改本地LARS Client端的远程URL

7. 集群模式

传统WAS中的Cell,在Liberty中称作Collective 传统WAS中的Deployment Manager,在Liberty中称作Collective Controller

8. Docker Image

IBM 官方Liberty Image https://hub.docker.com/_/websphere-liberty

docker pull websphere-liberty:full
docker pull websphere-liberty:20.0.0.9-full-java8-ibmjava

开源Liberty Image https://hub.docker.com/_/open-liberty

docker pull open-liberty:full
docker pull open-liberty:20.0.0.9-kernel-java8-openj9