Setup ip ports on Windows Server

I have couchbase server 6.6 on a Windows Server Machine.
And have Sync-gateway 2.8 installed.
When I go to 127.0.0.1:4984 I get the response:
{
“couchdb”: “Welcome”,
“vendor”: {
“name”: “Couchbase Sync Gateway”,
“version”: “2.8”
},
“version”: “Couchbase Sync Gateway/2.8.0(376;e2e7d42) EE”
}

When I go to “127.0.0.1:4984/bucket” I get:
{
“error”: “not_found”,
“reason”: “no such database “bucket””
}

Also, I have been able to replicate into this server from another but not able to replicate from this to the other.

Thank you for any help

8091?? That’s server admin UI port. The sync gateway public port is 4984…

I mistyped I am going to 4984, I will edit. Thanks

When using 4984 I have this issue

What is your sync gateway config? It appears that as the error indicates that there is no database configured.

{
    "interface": ":4984",
    "adminInterface":":4985",
    "logging": {
        "log_file_path": "/var/tmp/sglogs",
        "console": {
            "log_level": "debug",
            "log_keys": [
                "*"
            ]
        },
        "error": {
            "enabled": true,
            "rotation": {
                "max_size": 20,
                "max_age": 180
            }
        },
        "warn": {
            "enabled": true,
            "rotation": {
                "max_size": 20,
                "max_age": 90
            }
        },
        "info": {
            "enabled": false
        },
        "debug": {
            "enabled": false
        }
    },
    "CORS": {
        "origin":["http://localhost:9000", "http://127.0.0.1:9000"],
        "loginOrigin":["http://localhost:9000", "http://127.0.0.1:9000"],
        "headers":["Content-Type"],
        "maxAge": 1728000
    },
    "databases": {
	"testing": {
            "import_docs": true,
            "enable_shared_bucket_access": true,
            "bucket": "testing",
            "server": "http://192.168.0.12:8091",
            "username": "sync_gateway",
            "password": "password",
            "num_index_replicas": 0,
            "users":{
        	"GUEST":{
                    "disabled":false,
                    "admin_channels":["*"]
                }
            },
            "revs_limit": 20
        },
        "dvir": {
            "import_docs": true,
            "enable_shared_bucket_access": true,
            "bucket": "dvir",
            "server": "http://192.168.0.12:8091",
            "username": "sync_gateway",
            "password": "password",
            "num_index_replicas": 0,
            "users":{
        	"GUEST":{
                    "disabled":false,
                    "admin_channels":["*"]
                }
            },
            "revs_limit": 20
        },
	"tcsoffice": {
            "import_docs": true,
            "enable_shared_bucket_access": true,
            "bucket": "tcsoffice",
            "server": "http://192.168.0.12:8091",
            "username": "sync_gateway",
            "password": "password",
            "num_index_replicas": 0,
            "users": {
                "GUEST": {
                    "disabled": true
                },
                "admin": {
                    "password": "password",
                    "admin_channels": [
                        "*"
                    ]
                }
            },
            "revs_limit": 20
        },
	"webdata": {
            "import_docs": true,
            "enable_shared_bucket_access": true,
            "bucket": "webdata",
            "server": "http://192.168.0.12:8091",
            "username": "sync_gateway",
            "password": "password",
            "num_index_replicas": 0,
            "users": {
                "GUEST": {
                    "disabled": true
                },
                "admin": {
                    "password": "password",
                    "admin_channels": [
                        "*"
                    ]
                }
            },
            "revs_limit": 20
        }
    }
}

Your databases are called testing, dvir, tcsoffice, and webdata - so use one of those instead of bucket in the URL.

“bucket” was just a place holder, I have used “dvir” and “testing” my results are above.
Thanks

If you’re still seeing the database not found error for those database names you have in your config, then the config isn’t being used correctly when starting Sync Gateway.

Can you copy/paste the SG logs from startup? It will tell you which databases were found in the config.
You can also take a look at http://localhost:4985/_config to see the config SG is currently running with.

http://localhost:4985/_config does not work for me, even on a different CB server that I can see the db.
I get this msg on both (working server and notworking server):
{
“error”: “not_found”,
“reason”: “unknown URL”
}

Just to confirm, you’re hitting /_config on the Admin API port (4985), rather than the public API port (4984), correct?

opps, I was using 4984.

When I use 4985, I get not found.
" This site can’t be reached"

The Admin API is accessible from localhost only by default, for security reasons.

https://docs.couchbase.com/sync-gateway/current/start/gs-sgw-api-access.html

I got it now, It is showing the default config not “my config”

{“Interface”:“0.0.0.0:4984”,“AdminInterface”:“127.0.0.1:4985”,“Logging”:{“log_file_path”:“C:\Program Files\Couchbase\Sync Gateway\var\lib\couchbase\logs”,“console”:{“enabled”:false,“rotation”:{“max_size”:0,“max_age”:0,“rotated_logs_size_limit”:1024},“collation_buffer_size”:0,“log_level”:“none”,“log_keys”:[“HTTP”],“color_enabled”:false},“error”:{“rotation”:{}},“warn”:{“rotation”:{}},“info”:{“rotation”:{}},“debug”:{“rotation”:{}},“trace”:{“rotation”:{}},“stats”:{“rotation”:{}},“default”:{}},“SlowQueryWarningThreshold”:500,“Databases”:{“db”:{“server”:“walrus:data”,“pool”:“default”,“bucket”:“db”,“password”:“",“name”:“db”,“users”:{“GUEST”:{“name”:"",“admin_channels”:[""],“all_channels”:null,“password”:"*”}},“revs_limit”:20,“import_backup_old_rev”:false,“cache”:{“rev_cache”:{},“channel_cache”:{}},“unsupported”:{“user_views”:{},“oidc_test_provider”:{},“api_endpoints”:{},“warning_thresholds”:{“xattr_size_bytes”:943718,“channels_per_doc”:50,“access_and_role_grants_per_doc”:50},“oidc_tls_skip_verify”:false,“sgr_tls_skip_verify”:false},“deprecated”:{},“session_cookie_name”:"",“session_cookie_http_only”:false,“allow_conflicts”:false,“num_index_replicas”:null,“use_views”:false}}}

I have loaded it using:
“sync_gateway sync-gateway-config.json”
from the sync-gateway folder

loaded again and recieved msg:

Failed to start HTTP server on :4984: listen tcp :4984: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted. – rest.(*ServerConfig).Serve() at config.go:1041

Ok, so as suggested in the docs - the Sync Gateway Windows service will read a specific config by default:

To stop/start the service, you can use the Services application (Control Panel → Admin Tools → Services).

  • The configuration file is located under C:\Program Files\Couchbase\Sync Gateway\serviceconfig.json.

https://docs.couchbase.com/sync-gateway/current/start/gs-sgw-install.html

I’m guessing that’s still running in the background, bound to the ports you need - and by running it manually, you’re getting port conflicts.

I would read through that page, as it will help you with these issues you’re facing.

I stopped the sync-gateway service and ran the cmd again "sync_gateway sync-gateway-config.json”

I see the config now and the db. GREAT!

I believe I have done that before. Not sure why it fixed it now. I have done a lot of little things in between.

Thank you

@bbrks If is use the cmd "sync_gateway sync-gateway-config.json” it stays running in cmd window and I can see the _config.
But if I run sync-gateway in the services, I see the config but my app does not work.

I get the default config when I run sync-gateway through services.
And get my config when it is running in cmd window

The service script is going to be looking at the config file in the above filepath (this is all in the installation docs), whereas your command to explicitly run it is directly referencing your own config file at a different location.

I would suggest moving your own config file to C:\Program Files\Couchbase\Sync Gateway\serviceconfig.json so the service script reads it.