Kurento 实战之一:KMS 部署和体验
版本信息
操作系统:Ubuntu 16.04.5 LTS
KMS:6.13.0
JDK:1.8.0_191
SpringBoot:2.3.3.RELEASE
注意:本次实战全程使用 root 帐号
接下来开始部署 KMS;
操作
关闭防火墙;
安装 gnupg:
apt-get install --no-install-recommends --yes gnupg
设置环境变量:
DISTRO="xenial"
从密钥服务器下载密钥到可信任的密钥列表,为后面的安装做准备:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5AFA7A83
添加 kurentu 源地址:
tee "/etc/apt/sources.list.d/kurento.list" >/dev/null <<EOF
deb [arch=amd64] http://ubuntu.openvidu.io/6.13.0 $DISTRO kms6
EOF
安装 kms:
apt-get update && apt-get install --yes kurento-media-server
启动 kms:
service kurento-media-server start
查看 kms 状态,如下,可见服务启动成功(active):
root@docker:~# service kurento-media-server status
● kurento-media-server.service - LSB: Kurento Media Server daemon
Loaded: loaded (/etc/init.d/kurento-media-server; bad; vendor preset: enabled)
Active: active (running) since Fri 2021-01-01 05:39:24 PST; 2s ago
Docs: man:systemd-sysv-generator(8)
Process: 4815 ExecStart=/etc/init.d/kurento-media-server start (code=exited, status=0/SUCCESS)
Tasks: 24
Memory: 17.3M
CPU: 242ms
CGroup: /system.slice/kurento-media-server.service
└─4828 /usr/bin/kurento-media-server
Jan 01 05:39:24 docker systemd[1]: Starting LSB: Kurento Media Server daemon...
Jan 01 05:39:24 docker kurento-media-server[4815]: * Start Kurento Media Server
Jan 01 05:39:24 docker kurento-media-server[4815]: * Configure Kernel resource limits for Kurento Media Server
Jan 01 05:39:24 docker kurento-media-server[4815]: ...done.
Jan 01 05:39:24 docker systemd[1]: Started LSB: Kurento Media Server daemon.
执行以下命令确认响应是否正常:
curl -i -N \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Host: 127.0.0.1:8888" \
-H "Origin: 127.0.0.1" \
如果控制台响应以下内容,证明 KMS 已经可以正常服务了:
HTTP/1.1 500 Internal Server Error
Server: WebSocket++/0.7.0
至此,KMS 部署和启动已经完成,接下来咱们快速体验 KMS 的基础能力;
体验 KMS
接下来部署一个 SpringBoot 应用,通过应用的网页服务体验 KMS,这个应用部署在另一台电脑上(和 KMS 部署在一起也没任何问题),整个环境情况如下:
登录到上图的 192.168.133.208 电脑,关闭防火墙;
在 192.168.133.208 电脑上安装 JDK8;
本文的重点是 KMS 部署,关于 SpringBoot 应用无需开发,下载我准备好的 jar 文件即可,地址是:https://download.csdn.net/download/boling_cavalry/14012545
将 helloworld-0.0.1-SNAPSHOT.jar 下载到 192.168.133.208,再执行以下命令即可启动应用,注意参数-Dkms.url 的 IP 是 KMS 电脑的地址:
java -Dkms.url=ws://192.168.133.207:8888/kurento -jar helloworld-0.0.1-SNAPSHOT.jar
控制台输出以下内容,表示启动成功:
[root@centos7 ~]# java -Dkms.url=ws://192.168.133.207:8888/kurento -jar helloworld-0.0.1-SNAPSHOT.jar
. ____ _ __ _ _
/\ / _' __ _ () __ __ _ \ \ \ \
( ( )___ | '_ | '| | ' / _` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |__, | / / / /
=========||==============|/=///_/
:: Spring Boot :: (v2.3.3.RELEASE)
2021-01-03 12:30:56.702 WARN 24669 --- [ main] o.s.boot.StartupInfoLogger : InetAddress.getLocalHost().getHostName() took 10004 milliseconds to respond. Please verify your network configuration.
2021-01-03 12:31:06.719 INFO 24669 --- [ main] c.b.helloworld.HelloWorldApplication : Starting HelloWorldApplication on centos7 with PID 24669 (/root/helloworld-0.0.1-SNAPSHOT.jar started by root in /root)
2021-01-03 12:31:06.719 INFO 24669 --- [ main] c.b.helloworld.HelloWorldApplication : No active profile set, falling back to default profiles: default
2021-01-03 12:31:07.970 INFO 24669 --- [rbeatExec-e1-t0] o.k.j.c.JsonRpcClientNettyWebSocket : [KurentoClient] Connecting native client
2021-01-03 12:31:07.974 INFO 24669 --- [rbeatExec-e1-t0] o.k.j.c.JsonRpcClientNettyWebSocket : [KurentoClient] Creating new NioEventLoopGroup
2021-01-03 12:31:23.159 INFO 24669 --- [ntLoopGroup-2-1] o.k.j.c.JsonRpcClientNettyWebSocket : [KurentoClient] Initiating new Netty channel. Will cr
eate new handler too!
2021-01-03 12:31:23.267 WARN 24669 --- [ main] org.kurento.client.KurentoClient : Connected to KMS in 15294 millis (> 5000 millis)
2021-01-03 12:31:24.241 INFO 24669 --- [ main] c.b.helloworld.HelloWorldApplication : Started HelloWorldApplication in 53.092 seconds (JVM running for 53.509)
在浏览器访问地址:https://192.168.133.208:8443 ,由于使用了自签证书,浏览器会有安全提示,点击下图红框中的按钮:
点击下图红框中的链接,即可访问 SpringBoot 应用的首页:
评论