Hello,
I am creating a PowerShell script that will install MongoDB silently.
$installerPsi = New-Object System.Diagnostics.ProcessStartInfo
$installerPsi.FileName = "msiexec.exe"
$installerPsi.Arguments = "/l*v mdbinstall.log /qb /i `"$installerFilePath`" ADDLOCAL=`"ServerNoService,ServerService,Router`""
$installerPsi.UseShellExecute = $false
$installerPsi.CreateNoWindow = $false
# Start the process and wait for it to complete
$installerProcess = [System.Diagnostics.Process]::Start($installerPsi)
$installerProcess.WaitForExit()
After following the guide at: Install MongoDB Community on Windows using msiexec.exe
The bin has created with the files:
08/08/2024 02:35 PM 542 mongod.cfg
04/24/2024 06:14 PM 66,371,584 mongod.exe
04/24/2024 06:14 PM 1,041,952,768 mongod.pdb
04/24/2024 06:15 PM 40,086,016 mongos.exe
04/24/2024 06:15 PM 592,146,432 mongos.pdb
5 File(s) 1,740,557,342 bytes
After running Mongod using:
# Construct the command
$command = "--replSet $replicaSetName --dbpath `"$dbPath`" --bind_ip $localIP --port $port --setParameter allowMultipleArbiters=true"
# Define process start info
$mongodPsi = New-Object System.Diagnostics.ProcessStartInfo
$mongodPsi.FileName = "mongod"
$mongodPsi.RedirectStandardInput = $true
$mongodPsi.UseShellExecute = $false
$mongodPsi.Arguments = $command
# MongoDB instance should run in background
$mongodDbProcess = [System.Diagnostics.Process]::Start($mongodPsi)
I can’t reach the instance when I am trying to initialize the ReplicaSet:
MongoServerError[NodeNotFound]: replSetInitiate quorum check failed because not all proposed set members responded affirmatively: 10.186.64.65:27017 failed with Couldn't get a connection within the time limit
Now the Interesting part…
if I am using the msi gui and click "Next,I accept…,Complete,Next,Install MongoDB Compass (V) Next, Install.
I succeed with the initialization of the ReplicaSet.
Please help me make the silent installation equivalent to the GUI steps I did.
(I have a feeling that the (V) on the Compass configures the firewall rules)
THANK YOU!