f38d04c2ff | ||
---|---|---|
.. | ||
src | ||
test | ||
.dockerignore | ||
.eslintrc.js | ||
.gitignore | ||
.npmrc | ||
API.md | ||
README.md | ||
index.js | ||
package.json |
README.md
REST Server
Goal
REST Server exposes a set of interface that allows you to manage jobs.
Architecture
REST Server is a Node.js API service for PAI that deliver client requests to different upstream services, including FrameworkLauncher, Apache Hadoop YARN, WebHDFS and etcd, with some request transformation.
Dependencies
To start a REST Server service, the following services should be ready and correctly configured.
- FrameworkLauncher
- Apache Hadoop YARN
- HDFS
- etcd
Build
Run npm install
to install dependencies.
Configuration
If REST Server is deployed by pai management tool, configuration is located in
restserver
block of service configuration file, including:
server-port
: Integer. The network port to access the web portal. The default value is 9186.jwt-secret
: A random secret token for user authorization, keep it secret to users.default-pai-admin-username
: The username of default user. REST Server will auto generate it after the first start of service.default-pai-admin-password
: The password of default user.
If REST Server is deployed manually, the following fields should be configured as environment variables:
LAUNCHER_WEBSERVICE_URI
: URI endpoint of Framework LauncherHDFS_URI
: URI endpoint of HDFSWEBHDFS_URI
: URI endpoint of WebHDFSYARN_URI
: URI endpoint of Apache Hadoop YARNETCD_URI
: URI endpoints of ectd, could be multiple and separated by comma(,
)JWT_SECRET
: A random secret token for user authorization, keep it secret to users.DEFAULT_PAI_ADMIN_USERNAME
: The username of default user. REST Server will auto generate it after the first start of service.DEFAULT_PAI_ADMIN_PASSWORD
: The password of default user.
And the following field could be configured optionally:
LOG_LEVEL
: The log level of the service, default value isdebug
, could beerror
warn
info
debug
silly
SERVER_PORT
: The network port to access the web portal. The default value is 9186.
Deployment
The deployment of REST Server goes with the bootstrapping process of the whole PAI cluster, which is described in detail in Tutorial: Booting up the cluster.
If REST Server is need to be deployed as a standalone service, follow these steps:
- Go into
rest-server
directory - Run
npm start
Upgrading
REST Server is a stateless service, so it could be upgraded without any extra operation.
Service Metrics
TBD
Service Monitoring
TBD
High Availability
REST Server is a stateless service, so it could be extends for high availability without any extra operation.
Runtime Requirements
To run REST Server on system, a Node.js 6+ runtime is required, with npm installed.
API document
Read API document for the details of REST API.
FAQ
Q: What is the default username and password?
A: Default username and password is configured in
DEFAULT_PAI_ADMIN_USERNAME
andDEFAULT_PAI_ADMIN_PASSWORD
environment variables if service is deployed manually.restserver.default-pai-admin-username
andrestserver.default-pai-admin-password
field in service configuration file if service is deployed by pai management tool.
Q: Why can't I login with default username and password?
A: If there is already a
/users
directory in etcd, REST Server will not auto generate the default user, even it is empty and without any users. To regenerate default user, try delete the whole/users
directory and restart REST Server, a new default user will be generated.