pulsar-manager icon indicating copy to clipboard operation
pulsar-manager copied to clipboard

Pulsar Manager keeps saying "This environment is error. Please check it"

Open mikayeln opened this issue 5 years ago • 17 comments

OS: Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic

Hi, I have Pulsar instance running in standalone mode. Also I started Pulsar-Manager with docker. Here is the command line: docker run -it -p 9527:9527 -e REDIRECT_HOST=http://127.0.0.1 -e REDIRECT_PORT=9527 -e DRIVER_CLASS_NAME=org.postgresql.Driver -e URL='jdbc:postgresql://127.0.0.1:5432/pulsar_manager' -e USERNAME=pulsar -e PASSWORD=pulsar -e LOG_LEVEL=DEBUG -v $PWD:/data apachepulsar/pulsar-manager:v0.1.0 /bin/sh

On Add Environment action image i'm getting following error image

But there is no any errors in the logs of Pulsar.

Did I miss some configuraion?

Thanks.

mikayeln avatar Mar 27 '20 14:03 mikayeln

Please check whether your broker's network is connected and whether your service URL is port 8888? @mikayeln

tuteng avatar Mar 28 '20 15:03 tuteng

@tuteng Thanks for reply. URL port is 8888. I'm able to connect to pulsar from pulsar java client. Also, I checked the code of manager and found out that error occurs on GET request to /metrics. From browser I was able to get the metrics.

mikayeln avatar Mar 28 '20 15:03 mikayeln

I think you should try to check whether you can connect to the pulsar cluster in the container running pulsar-manager. @mikayeln

docker exec -it container_id /bin/sh
curl -v http://broker-ip:8888/metrics/

tuteng avatar Mar 29 '20 09:03 tuteng

it's because pulsar and pulsar-manger runs in different containers with theirself localhosts (each container just know itself localhost). you should either run these two containers in one network using something like docker composer, or set --network host in your command, something like this:

docker run --rm --network host -it  -e REDIRECT_HOST=http://localhost -e REDIRECT_PORT=9527 -e DRIVER_CLASS_NAME=org.postgresql.Driver -e URL='jdbc:postgresql://127.0.0.1:5432/pulsar_manager' -e USERNAME=pulsar -e PASSWORD=pulsar -e LOG_LEVEL=DEBUG -v $PWD:/data apachepulsar/pulsar-manager:v0.1.0 /bin/sh

mehran-prs avatar Apr 03 '20 22:04 mehran-prs

@mehran-prs thank you for the comment!

It would be great if we can add this example to README. Are you interested in contributing a fix?

sijie avatar Apr 09 '20 22:04 sijie

@mehran-prs thank you for the comment!

It would be great if we can add this example to README. Are you interested in contributing a fix?

@sijie

PR Created #314

josuemotte avatar Jul 01 '20 13:07 josuemotte

Hi I am also receiving this same message on Windows 10 after cloning the repo and using docker compose to start up the services.

When adding an environment I attempted to use the following for the Service URL: pulsar://localhost:6650 http://localhost:8080 http://pulsar-standalone:8080

all of which resulted in the same error message.

KVINTH avatar Nov 04 '20 22:11 KVINTH

Hi I am also receiving this same message on Windows 10 after cloning the repo and using docker compose to start up the services.

When adding an environment I attempted to use the following for the Service URL: pulsar://localhost:6650 http://localhost:8080 http://pulsar-standalone:8080

all of which resulted in the same error message.

For anyone else being blocked by this, it's again, because of the docker network. If you use http://proxy1:8080 you should be okay as this is the name of the container that's running the front proxy in the docker-compose environment. You can see the details of this by running docker network inspect kitchen-sink_pulsar

mipper avatar Jun 17 '21 14:06 mipper

Using http://pulsar:8080 as the service url works for me.

jamesvsshark avatar Feb 09 '22 02:02 jamesvsshark

pfoeh, that was hard, This worked for me eventually

docker-compose

  pulsar:
    image: apachepulsar/pulsar:latest
    container_name: shop_pulsar
    command: bin/pulsar standalone
    hostname: pulsar
    environment:
      PULSAR_MEM: " -Xms512m -Xmx512m -XX:MaxDirectMemorySize=1g"
    volumes:
      - ./tools/pulsar/data:/pulsar/data
    ports:
      - 6650:6650
      - 8080:8080 # http://localhost:8080/metrics/
    restart: unless-stopped
    networks:
      - acme

  pulsar-manager: 
    image: apachepulsar/pulsar-manager:latest
    container_name: shop_pulsar_manager
    ports:
      - 9527:9527 # http://localhost:9527 (login:pulsar/pulsar)
      - 7750:7750
    depends_on:
      - pulsar
    links:
      - pulsar
    environment:
      SPRING_CONFIGURATION_FILE: /pulsar-manager/pulsar-manager/application.properties
    networks:
      - acme

create a super-user using the following commands

  • shell into shop_pulsar_manager container
  • apk add curl
  • CSRF_TOKEN=$(curl http://shop_pulsar_manager:7750/pulsar-manager/csrf-token)
  • curl --verbose -H 'X-XSRF-TOKEN: $CSRF_TOKEN' -H 'Cookie: XSRF-TOKEN=$CSRF_TOKEN;' -H 'Content-Type: application/json' -X PUT http://shop_pulsar_manager:7750/pulsar-manager/users/superuser -d '{"name": "pulsar", "password": "pulsar", "description": "Pulsar Manager Admin", "email": "[email protected]"}'

create a new environment

  • open browser http://localhost:9527 and login with pulsar/pulsar
  • choose '+ new environment'
  • name=shop, service url=http://pulsar:8080

now have ro find a way to automate this within docker-compose....

vip32 avatar Mar 02 '22 21:03 vip32

Sorry guys I am also coming around the corner here with the same problem. however, for me it is in the AWS kubernetes environment. my cluster name is "pulsar-ci". I have tried the following URL, all without success:

  • http://pulsar-ci-broker:8080 // Service Url
  • http://pulsar-ci-broker-0:8080 // Broker Url
  • http://pulsar-ci-broker.pulsar.svc.cluster.local:8080 // Service Url, full qualified

then I tried in the container toolset "curl http://pulsar-ci-broker:8080/metrics/" which returns the metrics accordingly.

Does anyone have any ideas?

Cheers Hartmut

HartmutDIL avatar Mar 04 '22 21:03 HartmutDIL

I was able to solve the problem in the meantime. The reason was that JWT was switched on and therefore an unauthorized access attempt occurred which was of course rejected. The correct URL is therefore "http://pulsar-ci-broker:8080", for anyone who wants to know it

HartmutDIL avatar Mar 06 '22 14:03 HartmutDIL

Hello, guys!

Hello guys! I'm trying to create a new environment on a broker with basic authentication, but the same message appears: "This environment is error. Please check it". When I'm on a broker without basic authentication, everything works fine. I've already tried the following service URLs:

http://pulsar:8080 http://admin:apachepulsar@pulsar:8080 http://YWRtaW46YXBhY2hlcHVsc2Fy@pulsar:8080 (base64)

image

Please, anyone can help me to create a new environment in Pulsar Manager with basic authentication?

ThiagoRabeloFraga avatar Dec 01 '22 12:12 ThiagoRabeloFraga

A couple of things have changed since the last comments. pulsar/pulsar is no longer a valid username password combo out of the box even if you disabled user.management.enable. The documentation is wrong. For windows -> cmd users, you can create a CMD file and run this command to create a new super user:

for /F %%I in ('curl http://localhost:7750/pulsar-manager/csrf-token') do set CSRF_TOKEN=%%I curl -H "X-XSRF-TOKEN: %CSRF_TOKEN%" -H "Cookie: XSRF-TOKEN=%CSRF_TOKEN%;" -H "Content-Type: application/json" -X PUT http://localhost:7750/pulsar-manager/users/superuser -d "{\"name\": \"admin\", \"password\": \"apachepulsar\", \"description\": \"test\", \"email\": \"[email protected]\"}"

Username = admin Password = apachepulsar

Next. You don't HAVE to create the Pulsar Service and Pulsar Manager Client at the same time in the same file like vip32 suggested. If you want to do it separately you can, but it will create issues when adding a new environment because you have to remove the pulsar linked service in the compose file. For me the Service URL that worked was http://host.docker.internal:8086 (my service runs on 8086, default is 8080).

These didn't work. http://127.0.0.1:8086 http://localhost:8086

Maybe a host file change would have made them work, but I know host.docker.internal works since I have that host file entry.

bdlee420 avatar Mar 16 '23 17:03 bdlee420

Keeping Service URL as http://pulsar:8080 and Bookie URL as http://proxy:6650 worked for me.

GauravNagpal1 avatar Oct 10 '23 17:10 GauravNagpal1

Execute the following command in the pulsar container

hostname -i

If the IP address obtained here is 172.20.0.2, ServiceURL: http://172.20.0.2:8080 Bookie URL:http://172.20.0.2:6650

In my case, this solved the problem.

nibosea avatar Oct 19 '23 07:10 nibosea

I'm using docker-compose, what has worked for me is http://host.docker.internal:8080

jcucuzza avatar Nov 12 '23 07:11 jcucuzza