首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >作为服务将不会注册

作为服务将不会注册
EN

Stack Overflow用户
提问于 2020-06-19 13:15:23
回答 2查看 294关注 0票数 0

是否有人成功地让Memurai作为哨兵运行?在来自他们网站的指示之后,即使存在哨兵标志,memurai.exe --service-install --service-name "memurai-sentinel" --sentinel memurai-sentinel.conf也会生成sentinel directive while not in sentinel mode。去掉服务标志,它将作为一个哨兵运行,没有问题。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-06-24 17:47:00

Memurai团队刚刚发布了2.0.1版本,它修复了作为服务运行的问题。请访问https://www.memurai.com/get-memurai以获得持续的开发人员构建。

票数 3
EN

Stack Overflow用户

发布于 2020-06-22 18:14:02

在下一个版本中,Memurai团队应该会修复这个问题。编辑:在memurai2.0.1发行版中已经修复了这个问题。

同时,这里有一个使用PowerShell脚本通过其他方式在Windows上添加哨兵服务的解决方案:

  1. 安装Memurai。
  2. 将sentinel.conf复制到所需的哨兵工作目录。文件中的当前值假定为C:\sentinelconf\sentinel.conf。
  3. 用所需的配置更改sentinel.conf。当前值假定Redis实例将在默认端口的同一台计算机中运行。
  4. 以管理员身份运行"Windows“:PowerShell
    1. 开放sentinel_script.ps1
    2. 将文件开头的变量更改为所需的值。
    3. 运行脚本(F5)
    4. 如果它导致“在此系统上禁用正在运行的脚本”。错误:
      1. 在交互式shell中运行(没有引号):'Set-ExecutionPolicy RemoteSigned‘
      2. 再次运行脚本(F5)
      3. 在交互式shell中运行(没有引号):“Set-ExecutionPolicy受限”

  5. 在命令提示符中使用memurai-cli连接哨兵(没有引号):'memurai-cli -p 5000‘
  6. 发出命令测试哨兵(没有引号):‘哨兵大师’

样本sentinel.conf

代码语言:javascript
复制
# Copy this file to C:\sentinelconf\sentinel.conf
logfile "C:\sentinelconf\sentinel.log"
port 5000
sentinel monitor mymaster 127.0.0.1 6379 1
sentinel down-after-milliseconds mymaster 60000
sentinel failover-timeout mymaster 180000
sentinel parallel-syncs mymaster 1

sentinel_script.ps1文件:

代码语言:javascript
复制
# Full path of installed memurai.exe
$MemuraiBinPath="C:\Program Files\Memurai\memurai.exe"
# Full path of sentinel.conf
$SentinelConfPath="C:\sentinelconf\sentinel.conf"
# Full path of sentinel.log
$SentinelLogPath="C:\sentinelconf\sentinel.log"
# Desired name of the service
$SentinelServiceName="Memurai Sentinel"


# Get Network Service credentials
$NetworkServiceCredentials = New-Object -TypeName System.Management.Automation.PSCredential ("NT AUTHORITY\NETWORK SERVICE", (New-Object System.Security.SecureString))

# Create a service to start Memurai in Sentinel mode
New-Service -Name $SentinelServiceName -Credential $NetworkServiceCredentials -BinaryPathName "`"$MemuraiBinPath`" --service-run `"$SentinelConfPath`" --sentinel"

# Create a rule to give the Network Service account access to the paths.
$SentinelAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("NT AUTHORITY\NETWORK SERVICE", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")

# Get the path where the sentinel.conf file is located and add permissions.
$SentinelConfFolderPath = Split-Path $SentinelConfPath
$ConfPathAccessPermissions = Get-Acl $SentinelConfFolderPath
$ConfPathAccessPermissions.SetAccessRule($SentinelAccessRule)
Set-Acl $SentinelConfFolderPath $ConfPathAccessPermissions

# Get the path where the sentinel.log file is located and add permissions.
$SentinelLogFolderPath = Split-Path $SentinelLogPath
$LogPathAccessPermissions = Get-Acl $SentinelLogFolderPath
$LogPathAccessPermissions.SetAccessRule($SentinelAccessRule)
Set-Acl $SentinelLogFolderPath $LogPathAccessPermissions

# Start the Memurai Sentinel service.
Start-Service $SentinelServiceName

Write-Host "Started the $SentinelServiceName service."
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62471127

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档