# kurento-java **Repository Path**: ElivsJ/kurento-java ## Basic Information - **Project Name**: kurento-java - **Description**: 安装kurento-repository服务 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2026-06-16 - **Last Updated**: 2026-06-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 这个分支存储了kurento-repository的服务器端代码,通过配置可以做到kms和repository分离 值得注意的是github源代码中kurento-repository-server文件夹下的pom.xml文件在maven编译环节会出bug,需要改成此分支下的版本 Table of Contents ----------------- - [Running the server](#running-the-server) - [Dependencies](#dependencies) - [Binaries](#binaries) - [Configuration](#configuration) - [Logging configuration](#logging-configuration) - [Execution](#execution) - [Run at user-level](#run-at-user-level) - [Run as daemon](#run-as-daemon) - [Version upgrade](#version-upgrade) - [Installation over MongoDB](#installation-over-mongodb) - [Connection between kms and repository](#connection-between-kms-and-repository) - [Run kurento-tutorial-repository demo](#run-kurento-tutorial-repository-demo) Running the server ------------------ ### Dependencies * Ubuntu 14.04 LTS * [Java JDK][Java] version 7 or 8 * [MongoDB][mongo] * Kurento Media Server or connection with a running instance (to install follow the [official guide][kurento-install]) ### Binaries To build the installation binaries from the source code you'll need to have installed on your machine [Git][Git], [Java JDK][Java] and [Maven][Maven]. Clone the parent project, `kurento-java` from its [GitHub Repository][GitHub Kurento Java]. ``` $ git clone https://gitee.com/liuhuichuan/kurento-java.git ``` Then build the `kurento-repository-server` project together with its required modules: ``` $ cd kurento-java $ mvn clean package -DskipTests -Pdefault -am \ -pl kurento-repository/kurento-repository-server ``` Now unzip the generated install binaries (where `x.y.z` is the current version and could include the `-SNAPSHOT` suffix): ``` $ cd kurento-repository/kurento-repository-server/target $ unzip kurento-repository-server-x.y.z.zip ``` ### Configuration The configuration file, `kurento-repo.conf.json` is located in the `config` folder inside the uncompressed installation binaries. When installing the repository as a system service, the configuration files will be located after the installation inside `/etc/kurento`. 这个hostname要改成当前服务器的ip地址,它会被程序读入作为媒体文件的url。这个url供后端应用程序请求。 type要改成filesystem,当前代码中mongodb的api没有补全。 folder就是录制视频的存储位置。一定要改到已存在的目录! ``` $ cd kurento-repository-server-x.y.z $ vim config/kurento-repo.conf.json ``` The default contents of the configuration file: ```json { "repository": { "port": 7676, "hostname": "127.0.0.1", //mongodb or filesystem "type": "mongodb", "mongodb": { "dbName": "kurento", "gridName": "kfs", "urlConn": "mongodb://localhost" }, "filesystem": { "folder": "/tmp/repository" } } } ``` These properties and their values will configure the repository application. * `port` and `hostname` are where the HTTP repository servlet will be listening for incoming connections (REST API). * `type` indicates the storage type. The repository that stores media served by KMS can be backed by GridFS on MongoDB or it can use file storage directly on the system’s disks (regular filesystem). * `mongodb` configuration: * `dbname` is the database name * `gridName` is the name of the gridfs collection used for the repository * `urlConn` is the connection to the Mongo database * `filesystem` configuration: * `folder` is a local path to be used as media storage #### Logging configuration The logging configuration is specified by the file `kurento-repo-log4j.properties`, also found in the `config` folder. ``` $ cd kurento-repository-server-x.y.z $ vim config/kurento-repo-log4j.properties ``` In it, the location of the server's output log file can be set up, the default location will be `kurento-repository-server-x.y.z/logs/` (or `/var/log/kurento/` for system-wide installations). To change it, replace the `${kurento-repo.log.file}` variable for an absolute path on your system: ``` log4j.appender.file.File=${kurento-repo.log.file} ``` ### Execution There are two options for running the server: * user-level execution - doesn’t need additional installation steps, can be done right after uncompressing the installer * system-level execution - requires installation of the repository application as a system service, which enables automatic startup after system reboots In both cases, as the application uses the [Spring Boot][SpringBoot] framework, it executes inside an embedded Tomcat container instance, so there’s no need for extra deployment actions (like using a third-party servlet container). If required, the project's build configuration could be modified in order to generate a *WAR* instead of a *JAR*. #### Run at user-level After having [configured](#configuration) the server instance just execute the start script: ``` $ cd kurento-repository-server-x.y.z $ ./bin/start.sh ``` #### Run as daemon First install the repository after having built and uncompressed the generating binaries. **sudo** privileges are required to install it as a service: ``` $ cd kurento-repository-server-x.y.z $ sudo ./bin/install.sh ``` The service **kurento-repo** will be automatically started. Now, you can configure the repository as stated in the [previous section](#configuration) and restart the service. ``` $ sudo service kurento-repo {start|stop|status|restart|reload} ``` ### Version upgrade To update to a newer version, it suffices to follow once again the installation procedures. ### Installation over MongoDB github源代码里给了段MongoDB的安装命令,但是是针对ubuntu14.04的,在16.04版本会报错。 考虑到以后可能不用MongoDB,命令不贴了。 Connection between kms and repository ------------------------------------- 打洞服务器可以解决NAT后的主机程序无法被公网服务识别的问题。在部署好打洞服务器的情况下,需要在前端代码中 配置打洞服务器的ip及端口,同时也需要在docker内的kms配置文件中配置打洞服务器的ip及端口,这两者需要一致。 具体解决方法,可点击这里[点击这里]。 这篇博文的kms配置打洞服务器部分一处可能有问题,即: turnURL=kurento:kurento@you_url?transport=tcp 应改为 turnURL=kurento:kurento@you_url:you_port?transport=tcp Run kurento-tutorial-repository demo ------------------------------------ 在HelloWorldRecApp.java文件中把repository的ip改了。启动kms和repository服务。 在命令行执行 ``` mvn -U clean spring-boot:run \ -Dspring-boot.run.jvmArguments="\ -Dkms.url=ws://{KMS_HOST}:8888/kurento \ -Drepository.uri=http://repository_host:repository_url \ ``` 如果kms是运行在本地docker里的,那Kms.url这个参数可以省略。 [documentation]: http://www.kurento.org/documentation [FIWARE]: http://www.fiware.org [GitHub Kurento bugtracker]: https://github.com/Kurento/bugtracker/issues [GitHub Kurento Group]: https://github.com/kurento [kurentoms]: http://twitter.com/kurentoms [Kurento]: http://kurento.org [Kurento Blog]: http://www.kurento.org/blog [Kurento FIWARE Catalog Entry]: http://catalogue.fiware.org/enablers/stream-oriented-kurento [Kurento Netiquette Guidelines]: http://www.kurento.org/blog/kurento-netiquette-guidelines [Kurento Public Mailing list]: https://groups.google.com/forum/#!forum/kurento [KurentoImage]: https://secure.gravatar.com/avatar/21a2a12c56b2a91c8918d5779f1778bf?s=120 [Apache 2.0 License]: http://www.apache.org/licenses/LICENSE-2.0 [NUBOMEDIA]: http://www.nubomedia.eu [StackOverflow]: http://stackoverflow.com/search?q=kurento [Read-the-docs]: http://read-the-docs.readthedocs.org/ [readthedocs.org]: http://kurento.readthedocs.org/ [Open API specification]: http://kurento.github.io/doc-kurento/ [apiary.io]: http://docs.streamoriented.apiary.io/ [GitHub Kurento Java]: https://github.com/Kurento/kurento-java [kurento-install]: http://www.kurento.org/docs/current/installation_guide.html [helloworld-repository]: https://github.com/Kurento/kurento-tutorial-java/tree/master/kurento-hello-world-recording [mongo]: https://www.mongodb.org/ [mongo-install]: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/ [Spring]: https://spring.io/ [SpringBoot]: http://projects.spring.io/spring-boot/ [Git]: https://git-scm.com/ [Java]: http://www.oracle.com/technetwork/java/javase/downloads/index.html [Maven]: https://maven.apache.org/ [PCRE]: http://php.net/manual/en/book.pcre.php [点击这里]: https://blog.csdn.net/XRRRICK/article/details/85010829